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

[5.8] Pass notifiable email through reset link #28475

Merged
merged 3 commits into from
May 13, 2019

Conversation

dwightwatson
Copy link
Contributor

When you click the link from the password reset email, the controller/view try to get your email address from the request to pre-fill the email field of the form. It's a nice improvement to the user experience as it doesn't force them to enter their email again, but it isn't actually working at the moment.

This change will pass the notifiable's email address through the query string so that this feature actually works.

@dwightwatson dwightwatson changed the title Pass notifiable email through reset link [5.8] Pass notifiable email through reset link May 10, 2019
@taylorotwell
Copy link
Member

taylorotwell commented May 11, 2019

Attempted here: #21633

As you can see, you should probably use the contract method to get the email. Secondly, several people commented it would break their applications - though I'm not sure how or why.

@devcircus
Copy link
Contributor

This was breaking for me due to my own customizations. Not relevant any longer and many people have wanted this. Not sure why but the PRs for it will likely never stop so I say 👍🏻.

@dwightwatson
Copy link
Contributor Author

Gotcha, that looks a lot better. I'll update this PR to match, but let me know if you'd prefer to target 5.9 instead.

I feel like it's worth fixing this because the rest of the piping is already in place, it's just one missing piece of the puzzle, and it's a better experience for users.

@@ -47,7 +47,7 @@ public function via($notifiable)
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @param \Illuminate\Contracts\Auth\CanResetPassword $notifiable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't makes sense because you expect a notifiable here and not a CanResetPassword instance. You can't be 100% sure that it's a User instance you're receiving here. The change below is ok for me but let's keep the mixed type-hint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair, I was just lining up with the aforementioned PR. I'll fix this now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would a non-CanResetPassword implementation be trying to, well, reset their password?

Copy link
Member

@driesvints driesvints May 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinbean There's, for example, the if (static::$toMailCallback) { at the beginning which could let you do whatever you want with whatever implementation you have.

@taylorotwell taylorotwell merged commit d8a626c into laravel:5.8 May 13, 2019
@dwightwatson dwightwatson deleted the reset-email branch May 14, 2019 01:40
@mpyw
Copy link
Contributor

mpyw commented Dec 27, 2019

@dwightwatson @taylorotwell @driesvints Sending email parameter on GET requests seems to have a security risk. We should prevent servers from logging sensitive information.

I believe it's a bad approach "Retrieve from email, and then verify token". Just follow "Retrieve from token".

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

Successfully merging this pull request may close these issues.

7 participants