Skip to content

fix: update user email should not fail when current email doesn't exist#408

Merged
kangmingtay merged 6 commits intomasterfrom
km/fix-update-user-email
Mar 8, 2022
Merged

fix: update user email should not fail when current email doesn't exist#408
kangmingtay merged 6 commits intomasterfrom
km/fix-update-user-email

Conversation

@kangmingtay
Copy link
Member

What kind of change does this PR introduce?

  • Fixes issue where updating a user's email fails if the existing email is empty (when SECURE_EMAIL_CHANGE_ENABLED=true)
  • This issue happens because SECURE_EMAIL_CHANGE_ENABLED attempts to send an email confirmation link to both the current and new email, since the current email doesn't exist, the mail client fails to send the link.
  • Refactored the TemplateMailer to use an interface for the Mailer. This makes mocking the mailme.Mailer.Mail method easier rather than just mocking the EmailChangeMail method.
  • Added tests for updating a user

@kangmingtay kangmingtay requested review from J0 and awalias March 4, 2022 11:23
@kangmingtay kangmingtay changed the title fix: update user email fix: update user email should not fail when current email doesn't exist Mar 4, 2022
Copy link
Contributor

@J0 J0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kangmingtay kangmingtay merged commit 32b0802 into master Mar 8, 2022
@kangmingtay kangmingtay deleted the km/fix-update-user-email branch March 8, 2022 01:45
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

🎉 This PR is included in version 2.6.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

uxodb pushed a commit to uxodb/auth that referenced this pull request Nov 13, 2024
…st (supabase#408)

* fix: check if current email exists before sending

* refactor: create MailClient interface to mock mail method

* refactor: merge sendEmailChange & sendSecureEmailChange methods

* fix: allow single confirmation if current email doesn't exist

* test: add update user email tests

* add test for UserGet
LashaJini pushed a commit to LashaJini/auth that referenced this pull request Nov 13, 2024
…st (supabase#408)

* fix: check if current email exists before sending

* refactor: create MailClient interface to mock mail method

* refactor: merge sendEmailChange & sendSecureEmailChange methods

* fix: allow single confirmation if current email doesn't exist

* test: add update user email tests

* add test for UserGet
LashaJini pushed a commit to LashaJini/auth that referenced this pull request Nov 15, 2024
…st (supabase#408)

* fix: check if current email exists before sending

* refactor: create MailClient interface to mock mail method

* refactor: merge sendEmailChange & sendSecureEmailChange methods

* fix: allow single confirmation if current email doesn't exist

* test: add update user email tests

* add test for UserGet
cemalkilic pushed a commit that referenced this pull request Aug 7, 2025
…st (#408)

* fix: check if current email exists before sending

* refactor: create MailClient interface to mock mail method

* refactor: merge sendEmailChange & sendSecureEmailChange methods

* fix: allow single confirmation if current email doesn't exist

* test: add update user email tests

* add test for UserGet
xeladotbe pushed a commit to xeladotbe/supabase-auth that referenced this pull request Sep 27, 2025
…st (supabase#408)

* fix: check if current email exists before sending

* refactor: create MailClient interface to mock mail method

* refactor: merge sendEmailChange & sendSecureEmailChange methods

* fix: allow single confirmation if current email doesn't exist

* test: add update user email tests

* add test for UserGet
fadymak pushed a commit that referenced this pull request Sep 30, 2025
…st (#408)

* fix: check if current email exists before sending

* refactor: create MailClient interface to mock mail method

* refactor: merge sendEmailChange & sendSecureEmailChange methods

* fix: allow single confirmation if current email doesn't exist

* test: add update user email tests

* add test for UserGet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants