Fix email confirmation for users created through the superuser API

This commit is contained in:
Joseph Schorr 2015-03-03 14:26:48 -05:00
parent 2b64b348b2
commit edafa26e6e
2 changed files with 2 additions and 2 deletions

View file

@ -541,7 +541,7 @@ def confirm_user_email(code):
old_email = None
new_email = code.new_email
if new_email:
if new_email and new_email != old_email:
if find_user_by_email(new_email):
raise DataModelException('E-mail address already used.')

View file

@ -190,7 +190,7 @@ class SuperUserList(ApiResource):
# If mailing is turned on, send the user a verification email.
if features.MAILING:
confirmation = model.create_confirm_email_code(user, new_email=user.email)
confirmation = model.create_confirm_email_code(user)
send_confirmation_email(user.username, user.email, confirmation.code)
return {