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)
|
email=email)
|
||||||
user.save()
|
user.save()
|
||||||
UserProfile.create(user, realm, full_name, short_name)
|
UserProfile.create(user, realm, full_name, short_name)
|
||||||
return user
|
|
||||||
|
|
||||||
class ZephyrClass(models.Model):
|
class ZephyrClass(models.Model):
|
||||||
name = models.CharField(max_length=30, db_index=True)
|
name = models.CharField(max_length=30, db_index=True)
|
||||||
|
|
|
@ -167,15 +167,16 @@ def zephyr(request):
|
||||||
@login_required
|
@login_required
|
||||||
@require_post
|
@require_post
|
||||||
def forge_zephyr(request):
|
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)
|
user_profile = UserProfile.objects.get(user=request.user)
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(email=email)
|
user = User.objects.get(email=email)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
# forge a user for this person
|
# 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['fullname']),
|
||||||
sanitize_identifier(request.POST['shortname']))
|
sanitize_identifier(request.POST['shortname']))
|
||||||
|
user = User.objects.get(email=email)
|
||||||
|
|
||||||
return zephyr_backend(request, user)
|
return zephyr_backend(request, user)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue