Skip to content

How to implement recover account? #39

@dorelljames

Description

@dorelljames

In my Recover page, I have a function component that takes the user password. This is given that the token is catched from runRoutes. I basically followed the implementation recovery action guide from here.

The thing that I can't figure out is whether recoverAccount and updateUser is the way to go? Problem is updateUser fails.

recoverAccount(true)
      .then((userFromToken) => {
        console.log("userFromToken", userFromToken);
        
        // --> This doesn't work. It says, user is not logged in.
        updateUser({ password })
          .then((updatedUser) => {
            setFormState("user_updated");
            console.log("Updated user %s", updatedUser);
          })
          .catch((error) => {
            console.log("Failed to update user: %o", error);
          });
      })
      .catch((error) => {
        console.log(error);
      });

Alternatively, I used verifyToken and setUser which is not recommended. The same updateUser function call doesn't seem to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions