MoralisWeb3 / Moralis-JS-SDK

Moralis Official Javascript SDK
https://docs.moralis.io
Other
368 stars 257 forks source link

user session in localStorage not updated when changing emailVerified value in User object #487

Closed matiyin closed 2 years ago

matiyin commented 2 years ago

New Bug Report

Checklist

Issue Description

The user session in localStorage is not updated when changing the emailVerified value in a User object. User needs to log in and out to show the correct setting for emailVerfied. Since all other fields are updated fine, I'm expecting this value to also update when changed in the User object.

Steps + code to reproduce

  1. verify email for a user by using await Moralis.User.requestEmailVerification('<email>') and returning the email callback
  2. check that Moralis.User.current().get('emailVerified') is not returning true
  3. Log out and back in
  4. check that Moralis.User.current().get('emailVerified') is returning true

Actual Outcome

After a successful email verification, Moralis.User.current().get('emailVerified') is not returning true in the current session

Expected Outcome

After a successful email verification, Moralis.User.current().get('emailVerified') is should return true in the current session

Environment

Server

Client

ErnoW commented 2 years ago

It might take some time before the user verifies the email. Therefore we do not know when to refetch the data.

So it depends on the use-case when you want/need to refetch the user data. Once you know that the user has verified the email, you can call:

await Moralis.User.current().fetch();

This will refetch the data from the current from the server.

ErnoW commented 2 years ago

If you have more questions then please reach out to moralis.forum.io for any other support. We have a more active people over there working to help out with any questions or support.