-
Notifications
You must be signed in to change notification settings - Fork 399
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
fix: allow user to update phone number #421
Conversation
@@ -29,39 +34,51 @@ func (a *API) formatPhoneNumber(phone string) string { | |||
return strings.ReplaceAll(strings.Trim(phone, "+"), " ", "") | |||
} | |||
|
|||
func (a *API) sendPhoneConfirmation(ctx context.Context, tx *storage.Connection, user *models.User, phone string) error { | |||
// sendPhoneConfirmation sends an otp to the user's phone number | |||
func (a *API) sendPhoneConfirmation(ctx context.Context, tx *storage.Connection, user *models.User, phone, otpType string, smsProvider sms_provider.SmsProvider) error { |
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.
Changed the function signature here to take in an otpType
and a smsProvider
. The smsProvider
was added to the function params to make it easier to test this function with a mock sms provider that implements a stub SendSms
method. See TestSendPhoneConfirmation.
LGTM, thanks for the PR! |
🎉 This PR is included in version 2.6.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
* refactor: sendPhoneConfirmation should accept an otpType and smsProvider * fix: allow update phone for users endpoint * fix: add phone change verification method
update README docs for supabase#421
* refactor: sendPhoneConfirmation should accept an otpType and smsProvider * fix: allow update phone for users endpoint * fix: add phone change verification method
update README docs for supabase#421
* refactor: sendPhoneConfirmation should accept an otpType and smsProvider * fix: allow update phone for users endpoint * fix: add phone change verification method
update README docs for supabase#421
What kind of change does this PR introduce?
GOTRUE_SMS_AUTOCONFIRM
is enabled, an otp will not be sent to the new phone number, else, an otp will be sent to the new phone number and the user has to verify it first.phone_change
which when set, will verify if the token sent is valid when compared to thephone_change_token
andphone_change_sent_at
fieldsTo-Do
phone_change
verification type (https://github.com/supabase/gotrue-js/blob/master/src/lib/types.ts#L202)