4

I could just put "Email:" field into "Edit profile" form (that is the form to edit current user information) of my site.

But this way it is possible that a user both changes the email in a wrong way and forgets his password. Then he would become unable to restore the password, because password restoration at my site requires sending email to the user.

What is the proper workflow (or workflows?) to change user's email?

1 Answer 1

10

Changing email is not allowed by some of the web applications due to security reasons. Some of the apps which allow this uses the following workflow:

  1. You present the editable section where the user can update the email address.
  2. Once the user changes the email, a confirmation email is sent to the new email address which contains a link to verify the email address. Note that you don't update the email address in database till now.
  3. Once the user verifies the email using the link sent to the new email address, you update the email address in your backend. Also, note that the link has an expiry time. Beyond the expiry time, the link becomes useless.
  4. As a security measure, you send an email to the old email address which contains a message about the action which is performed recently. Along with the message, you share a help/support link for the user to contact you in case of the action was not performed by him.
  5. If the user contacts you about the unauthorized action in his account, you verify the critical information related to the user and then takes necessary action.

This is how you update the user email address.

2
  • 1
    For security purposes, you probably want to send the confirmation to the old email rather than the new email. If a malicious attacker conducts the email change, they will validate the new email since that's the one they control. From there, they can use their email to trigger a password reset flow and take over the account. However, the old email would still be in the account user's control rather than the attacker. Sending the notification to the old email is more likely to stop a malicious attack.
    – Barrios
    Oct 18, 2021 at 16:35
  • @Barrios That's covered in step 4. In such a case, the genuine user still has access to his account with the given links in the information email.
    – K K
    Oct 21, 2021 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.