Merge pull request #20011 from edx/ttracy/ENT-1584-tracking-for-email-change

Ttracy/ent 1584 tracking for email change
This commit is contained in:
Thomas Tracy
2019-03-27 09:26:45 -04:00
committed by GitHub

View File

@@ -912,11 +912,20 @@ def password_reset_confirm_wrapper(request, uidb36=None, token=None):
# get the updated user
updated_user = User.objects.get(id=uid_int)
if 'is_account_recovery' in request.GET:
try:
updated_user.email = updated_user.account_recovery.secondary_email
updated_user.account_recovery.delete()
# emit an event that the user changed their secondary email to the primary email
tracker.emit(
SETTING_CHANGE_INITIATED,
{
"setting": "email",
"old": user.email,
"new": updated_user.email,
"user_id": updated_user.id,
}
)
except ObjectDoesNotExist:
log.error(
'Account recovery process initiated without AccountRecovery instance for user {username}'.format(