Skip to content
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

Chore: test email updates #58

Closed
wants to merge 2 commits into from
Closed

Conversation

kiwicopple
Copy link
Member

Mock up tests for #57

@kiwicopple kiwicopple requested review from thorwebdev and removed request for thorwebdev February 15, 2021 09:10
Comment on lines +154 to +156
let user = data
if (data.new_email) user.email = data.new_email
return { user, data, error: null }
Copy link
Member Author

Choose a reason for hiding this comment

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

This is one way we can resolve the strange behavior

we might even want to add an initial_email field which stores the email that the user first used during signup? I think it's even better to be added to the app_data

{
  "app_metadata": Object {
    "provider": "email",
    "initial_email": "user@email.com"
  },
  "email": "updated@email.com",         // original email
  "id": Any<String>,
  "role": "",
}

Choose a reason for hiding this comment

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

this solution seems great!

In a future version it would be cool to differentiate the email from the user login, and to be able to choose a username.

@asciidiego
Copy link

is this fixed yet?

@kangmingtay
Copy link
Member

Hey @diegonyc, @Etheonor, as mentioned in #67:

i think this issue has been resolved already. You can update your email with supabase.auth.updateUser which will return a user object with the new_email field. You'll have to verify the email change confirmation link that's sent to your email before you can login with the new_email.

Also, this fix wouldn't be appropriate since the new_email isn't confirmed yet. By setting it to the user.email here, we're assuming that the user has already confirmed the new email address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants