Skip to content

can't login after change password #96

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

Closed
maulikkanani1 opened this issue Apr 16, 2018 · 3 comments
Closed

can't login after change password #96

maulikkanani1 opened this issue Apr 16, 2018 · 3 comments

Comments

@maulikkanani1
Copy link

maulikkanani1 commented Apr 16, 2018

Expected behavior

When I call the resetPwdLong API with token in my postman with following detail.
POST http://localhost:3030/authmanagement

{
"action":"resetPwdLong",
"value": {
"token": "token",
"password":"my new password"
}
}

My password was changed successfully
After changing password successfully, I can not log in with a new password, and can't log in with the old password also.

i also try resetPwdShort method.
POST http://localhost:3030/authmanagement

{
"action":"resetPwdShort",
"value": {
"user": identifyUser, // identify user, e.g. {email: '[email protected]'}. See options.identifyUserProps.,
"token": "token",
"password":"my new password"
}
}

it's give me an following error:

{
"name": "BadRequest",
"message": "Invalid token. Get for a new one. (authManagement)",
"code": 400,
"className": "bad-request",
"data": {},
"errors": {
"$className": "badParam"
}
}

please, any one help me.

@eddyystop
Copy link
Collaborator

Do you have a hashPassword hook defined for on the user service? The package hashes the password itself, so if you also have a hashpassword hook that password is being hashed twice.

The hashPassword hook should only execute for other calls. There are 2 articles on Medium showing how to do this.

@maulikkanani1
Copy link
Author

thank @eddyystop, I solve this issue.
my mistake was in user hook I update my password twice:

  1. patch: [auth.hashPassword()]
    and
  2. commonHooks.iff(
    commonHooks.isProvider('external'),
    hashPassword(),
    ),

@eddyystop
Copy link
Collaborator

No problem. That is the most common made.

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

No branches or pull requests

2 participants