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

Reset password not working properly #7037

Open
llefort001 opened this issue Mar 16, 2023 · 0 comments · May be fixed by #7438
Open

Reset password not working properly #7037

llefort001 opened this issue Mar 16, 2023 · 0 comments · May be fixed by #7438
Labels
Bug Error or unexpected behavior of already existing functionality

Comments

@llefort001
Copy link
Contributor

Q A
Sulu Version 2.5.7
PHP Version 8.2.2
DB Version MariaDB 10.3.36
Browser Version Chrome 109.0.5414.74

Actual Behavior

Reset password does not work properly.
If someone makes a reset password request, request works and "passwordResetTokenEmailsSent" goes up to 3.
Even 48h after, passwordResetTokenEmailsSent stays at 3, so reset emails are not sent.
BUT, this number is never reset to 0, even if time interval (24h) is done.

Expected Behavior

passwordResetTokenEmailsSent should reset to 0 if a new request is made after 24h interval.

Steps to Reproduce

In admin login form :

  • Forgot password
  • Fill email/user
  • request password x>3 times

You should receive max 3 emails.

In database :

  • Change value of passwordResetTokenExpiresAt : substract some days/months so expiresAt < Now DateTime

In admin login form :

  • Request password

You should not receive emails, because, when requesting, it generates a new token that expires in 24h BEFORE checking if your passwordResetTokenEmailsSent and passwordResetTokenExpiresAt. Then it checks theses 2 values.
Of course, your newly generated token expires in 24h and your passwordResetTokenEmailsSent is still at 3, so you will not receive any email.

Possible Solutions

In \Sulu\Bundle\SecurityBundle\Controller\ResettingController::sendEmailAction , calling
$token = $this->generateTokenForUser($user);
then
$this->sendTokenEmail($user, $this->getSenderAddress($request), $email, $token);

Conditions are verified in \Sulu\Bundle\SecurityBundle\Controller\ResettingController::sendTokenEmail.

These conditions should be verified in generateTokenForUser and not in sendTokenEmail as generateTokenForUser updates values of the conditions and makes it irrelevant.

@llefort001 llefort001 added the Bug Error or unexpected behavior of already existing functionality label Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error or unexpected behavior of already existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant