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

ControllerTrait clear token #306

Closed
jp-insitaction opened this issue Apr 11, 2024 · 2 comments
Closed

ControllerTrait clear token #306

jp-insitaction opened this issue Apr 11, 2024 · 2 comments
Labels
Status: Waiting Feedback Needs feedback from the author

Comments

@jp-insitaction
Copy link

Hello,

I use this bundle with Symfony 6.4, to go faster I use the make:reset-password command as indicated in the documentation.

The Controller created from the maker has the method processSendingPasswordResetEmail, this method uses the "ResetPasswordControllerTrait" and its method setTokenObjectInSession, which store this token in the session to be retrieved in the next step, but just before storing the token, it empties it, so in session the token is invalid.

private function setTokenObjectInSession(ResetPasswordToken $token): void
{
    $token->clearToken();

    $this->getSessionService()->set('ResetPasswordToken', $token);
}

Is this an error?

@jrushlow
Copy link
Collaborator

Howdy @jp-insitaction - Now this is the intended functionality. I wrote a pretty detailed explainer on this here: #288 (comment) - "step 3" specifically talks about how we use the session to allow for displaying the "lifetime" of the token in the template but also guard against potential attack vectors.

Let me know if you have anymore questions or If that comment doesn't explain it clearly.

@jrushlow jrushlow added the Status: Waiting Feedback Needs feedback from the author label Apr 17, 2024
@jrushlow
Copy link
Collaborator

Closing - Feel free to comment is you still have any questions and we'll open the issue back up. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Waiting Feedback Needs feedback from the author
Projects
None yet
Development

No branches or pull requests

2 participants