mirror of https://github.com/zulip/zulip.git
forge_zephyr: Convert email to lowercase
This fixes failing User.object.get(email=...) (imported from commit e0d5097520c6a149031e6881ae25f4c5bb967918)
This commit is contained in:
parent
a68a3e7ab7
commit
85abb3f274
|
@ -98,7 +98,6 @@ def create_user(email, password, realm, full_name, short_name):
|
|||
email=email)
|
||||
user.save()
|
||||
UserProfile.create(user, realm, full_name, short_name)
|
||||
return user
|
||||
|
||||
class ZephyrClass(models.Model):
|
||||
name = models.CharField(max_length=30, db_index=True)
|
||||
|
|
|
@ -167,15 +167,16 @@ def zephyr(request):
|
|||
@login_required
|
||||
@require_post
|
||||
def forge_zephyr(request):
|
||||
email = sanitize_identifier(request.POST['sender'])
|
||||
email = sanitize_identifier(request.POST['sender']).lower()
|
||||
user_profile = UserProfile.objects.get(user=request.user)
|
||||
try:
|
||||
user = User.objects.get(email=email)
|
||||
except User.DoesNotExist:
|
||||
# forge a user for this person
|
||||
user = create_user(email, "test", user_profile.realm,
|
||||
create_user(email, "test", user_profile.realm,
|
||||
sanitize_identifier(request.POST['fullname']),
|
||||
sanitize_identifier(request.POST['shortname']))
|
||||
user = User.objects.get(email=email)
|
||||
|
||||
return zephyr_backend(request, user)
|
||||
|
||||
|
|
Loading…
Reference in New Issue