Skip to content

[5.8] Pass notifiable email through reset link#28475

Merged
taylorotwell merged 3 commits into
laravel:5.8from
dwightwatson:reset-email
May 13, 2019
Merged

[5.8] Pass notifiable email through reset link#28475
taylorotwell merged 3 commits into
laravel:5.8from
dwightwatson:reset-email

Conversation

@dwightwatson

Copy link
Copy Markdown
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

taylorotwell commented May 11, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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.

* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @param \Illuminate\Contracts\Auth\CanResetPassword $notifiable

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@driesvints driesvints May 16, 2019

Copy link
Copy Markdown
Member

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

mpyw commented Dec 27, 2019

Copy link
Copy Markdown
Contributor

@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