mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 00:29:40 +03:00
Verification Code Sent to Old Email #1088
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AliAlhajji on GitHub (Jul 29, 2021).
Subject of the issue
I changed my email successfully, and verified the new email. However, when I try to login using 2FA, the verification code is sent to the old one.
I tried to re-enable the email 2FA, and it showed me a message that the code will be sent to the new email. But it's still sent to the old one.
Deployment environment
Config (Generated via diagnostics page)
Show Running Config
Environment settings which are overridden: DOMAIN, SIGNUPS_ALLOWED, INVITATIONS_ALLOWED, SHOW_PASSWORD_HINT, ADMIN_TOKEN, SMTP_HOST, SMTP_SSL, SMTP_PORT, SMTP_FROM, SMTP_USERNAME, SMTP_PASSWORD
Install method: Docker image
Clients used: Web vault
Steps to reproduce
Expected behaviour
Login is successful and verification code is sent to the new email.
Actual behaviour
Login is successful but verification code is sent to the old email.
Troubleshooting data
New email in account page:
New email in 2 Step Login option:
Code sent to old email:
@AliAlhajji commented on GitHub (Jul 29, 2021):
Update
I disabled the two step login and enabled it again with the new email, and it worked.
It seems that the issue is that the Two Step Login page says the new email will be used to authenticate, but in fact the email did not change in the database. I had to disable it and then enable it again to change it.
@stefan0xC commented on GitHub (Aug 9, 2021):
To clarify the issue is that the email shown as the two-step login provider in the web vault is not the configured address but the account address.
Having the code sent to the configured address is in my opinion the correct behavior. Changing the email address of the two-step login provider when I change my account email address would be an unexpected side effect.
@AliAlhajji commented on GitHub (Aug 9, 2021):
When I updated the account email, the two factor email page showed me the new email as well. But the code was sent to the old one (which is not seen anymore in the two factor page).
You can see this in the second screenshot. My account email was changed to new@email.com .. and in the two factor page I see new@emai.com as well. But the code is sent to old@email.com. I could fix that only by disabling the two factor authentication and then re-enabling it again.
@stefan0xC commented on GitHub (Aug 9, 2021):
Yes. You have to configure the two-step login separately. The issue is that it says new@email.com where old@email.com has been configured (because the two-step login mail provider was and should not be affected by the change of the account email to new@email.com).
If you change the two step login provider to alternative@example.com the email address shown (after reloading the dialog) will be your account email address (e.g. new@email.com) and not alternative@example.com, even if the two-step verification code will be sent to alternative@example.com.
If you have configured another email address it will always say the incorrect thing here:

But it actually does the correct thing:

@BlackDex commented on GitHub (Aug 18, 2021):
I just checked the code, and this is an actual bug.
The code doesn't return what is configured, but what the current user account e-mail is.
While actually sending the e-mail does use what is stored within the database.
@MartinTeichler commented on GitHub (Mar 8, 2025):
This has happened to me just now. I bought a domain and created a custom email address so I can ditch Outlook. Luckily, I didn't delete the Outlook address yet or I would now be locked out.
This all happened after I updated to the latest docker image. Now I am running the latest version
Edit: It seems that in the database, the entry for my account in the table "twofactor" was removed but not readded when I changed my email address. Adding this entry manually resolved the error. What was weird is that I could still see my recovery codes and use them to login.
@Temtaime commented on GitHub (Jan 9, 2026):
The issue still persist with latest release
@BlackDex commented on GitHub (Jan 10, 2026):
Are you sure that the mfa email is set correct? That is different from the login mail, and is not affected during email change.