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

[10.x] Update ResetPassword.php #41109

Closed
wants to merge 3 commits into from

Conversation

krusche-sensetence
Copy link

Setting
ResetPassword::createUrlUsing
was useless if also
ResetPassword::toMailUsing
was set.

The resetUrl wasn't calculated by the given ResetPassword::createUrlUsing callback and wasn't passed to the ResetPassword::toMailUsing callback.

@driesvints driesvints changed the title Update ResetPassword.php [10.x] Update ResetPassword.php Feb 18, 2022
@taylorotwell
Copy link
Member

Why was sent to master? Is it breaking?

@driesvints
Copy link
Member

@taylorotwell this will fail on 9.x after the test @crynobone sent in earlier today.

@taylorotwell
Copy link
Member

#41104

Putting this here for reference.

@crynobone
Copy link
Member

With these changes and app without password.reset, you will need to update the following code:

Before

ResetPassword::toMailUsing(function ($notifiable, $token) {
    return (new MailMessage)
        ->subject(__('Reset Password Notification'))
        ->line(__('You are receiving this email because we received a password reset request for your account.'))
        ->action(__('Reset Password'), route('custom.password.reset', $token))
        ->line(__('If you did not request a password reset, no further action is required.'));
});

After

ResetPassword::createUrlUsing(function ($user, string $token) {
    return route('custom.password.reset', $token);
});

ResetPassword::toMailUsing(function ($notifiable, $token, $resetUrl) {
    return (new MailMessage)
        ->subject(__('Reset Password Notification'))
        ->line(__('You are receiving this email because we received a password reset request for your account.'))
        ->action(__('Reset Password'), $resetUrl)
        ->line(__('If you did not request a password reset, no further action is required.'));
});

@krusche-sensetence
Copy link
Author

@crynobone I adjusted the test

@taylorotwell
Copy link
Member

I don't think I'm going to make this change. I think if you are using toMailUsing it is assumed you will create your own URL within that callback.

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.

4 participants