Skip to content

Commit

Permalink
combine conditions into single variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish committed Mar 20, 2019
1 parent 1b7d0b6 commit 2674f16
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions redash/handlers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,15 @@ def post(self, user_id):
abort(400, message='Bad email address.')

email_address_changed = 'email' in params and params['email'] != user.email
if email_address_changed and settings.email_server_is_configured():
needs_to_verify_email = email_address_changed and settings.email_server_is_configured()
if needs_to_verify_email:
user.is_email_verified = False

try:
self.update_model(user, params)
models.db.session.commit()

if email_address_changed and settings.email_server_is_configured():
if needs_to_verify_email:
send_verify_email(user, self.current_org)

# The user has updated their email or password. This should invalidate all _other_ sessions,
Expand Down

0 comments on commit 2674f16

Please sign in to comment.