Also accept user-modified webhook when old email address is unknown.

When the old email address is unknown, and the new one does map to a user,
use the webhook to update the new user.
This commit is contained in:
2017-12-20 11:40:56 +01:00
parent ae700b5eef
commit be4b36a661
2 changed files with 25 additions and 2 deletions

View File

@@ -76,8 +76,10 @@ def user_modified():
users_coll = current_app.db('users')
db_user = users_coll.find_one({'email': payload['old_email']})
if not db_user:
my_log.info('Received update for unknown user %r', payload['old_email'])
return '', 204
db_user = users_coll.find_one({'email': payload['email']})
if not db_user:
my_log.info('Received update for unknown user %r', payload['old_email'])
return '', 204
# Use direct database updates to change the email and full name.
updates = {}