-
Notifications
You must be signed in to change notification settings - Fork 567
fix: send-email hook - bug in email change verification #2044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First I added send email tests for the basic EmailChange flows to better understand the existing behavior. There is currently a bug in the existing send-email hooks which omits the token during email changes for anonymous users when the SecureEmailChange config value is set to false. I've also identified a bug with the token hashes being mixed up. The tests lock in this behavior so we don't break existing hooks code.
This change sets EmailData.Token to the new OTP when the secure email change setting is set to true. Note: I am fixing this bug in a way that is consistent with what I view to be the current bug. I believe for email changes token_new and token_hash_new should always contain the values for the users new_email field. This should be fixed in the future in a way that doesn't break BC.
2 tasks
hf
approved these changes
Jun 3, 2025
Contributor
hf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Contributor
|
Don't forget to update public docs |
Pull Request Test Coverage Report for Build 15426761119Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
cstockton
pushed a commit
that referenced
this pull request
Jun 5, 2025
🤖 I have created a release *beep* *boop* --- ## [2.175.0](v2.174.0...v2.175.0) (2025-06-03) ### Features * hooks round 5 (Option 2) - add before-user-created hook ([#2034](#2034)) ([b53f6b0](b53f6b0)) ### Bug Fixes * email-sendhook - bug in email change verification ([#2044](#2044)) ([be20654](be20654)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2 tasks
cemalkilic
pushed a commit
that referenced
this pull request
Aug 7, 2025
This change sets EmailData.Token to the new OTP when the secure email change setting is set to true. This should fix: #1744 #2042 Note: I am fixing this bug in a way that is consistent with what I view to be the current bug. I believe for email changes token_new and token_hash_new should always contain the values for the users new_email field. This should be fixed in the future in a way that doesn't break BC. --------- Co-authored-by: Chris Stockton <chris.stockton@supabase.io>
cemalkilic
pushed a commit
that referenced
this pull request
Aug 7, 2025
🤖 I have created a release *beep* *boop* --- ## [2.175.0](v2.174.0...v2.175.0) (2025-06-03) ### Features * hooks round 5 (Option 2) - add before-user-created hook ([#2034](#2034)) ([b53f6b0](b53f6b0)) ### Bug Fixes * email-sendhook - bug in email change verification ([#2044](#2044)) ([be20654](be20654)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
issuedat
pushed a commit
that referenced
this pull request
Sep 30, 2025
This change sets EmailData.Token to the new OTP when the secure email change setting is set to true. This should fix: #1744 #2042 Note: I am fixing this bug in a way that is consistent with what I view to be the current bug. I believe for email changes token_new and token_hash_new should always contain the values for the users new_email field. This should be fixed in the future in a way that doesn't break BC. --------- Co-authored-by: Chris Stockton <chris.stockton@supabase.io>
issuedat
pushed a commit
that referenced
this pull request
Sep 30, 2025
🤖 I have created a release *beep* *boop* --- ## [2.175.0](v2.174.0...v2.175.0) (2025-06-03) ### Features * hooks round 5 (Option 2) - add before-user-created hook ([#2034](#2034)) ([b53f6b0](b53f6b0)) ### Bug Fixes * email-sendhook - bug in email change verification ([#2044](#2044)) ([be20654](be20654)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change sets EmailData.Token to the new OTP when the secure email change setting is set to true.
This should fix:
#1744
#2042
Note:
I am fixing this bug in a way that is consistent with what I view to be the current bug. I believe for email changes token_new and token_hash_new should always contain the values for the users new_email field. This should be fixed in the future in a way that doesn't break BC.