Reputation: 1145
I'm using fortify for authentication stuff, however I need to change the text in the "Reset Password" email template automatically sent by fortify. I can't find a way to achieve this.
Also is it possible to make the template editable from Nova ? I have a MailTemplate Resource in Nova to allow changing email template from Nova, but I can't achieve this for the "Reset Password email" since it's sent by fortify and can't find a way to control it.
Upvotes: 2
Views: 6012
Reputation: 10210
Fortify uses the core notification system from Laravel to send the password reset email. The specific file responsible for this is the PasswordReset.php
file located at Illuminate\Auth\Notifications
.
The simplest way to customise the email that is sent would be to make a copy of the PasswordReset
file and save it to your project somewhere (e.g. App\Notifications
) with a different name (optional).
Once copied and you've customised it to your liking, you'll then need to overwrite the sendPasswordResetNotification
method on your User
model which is inherited from the CanResetPassword
trait on the Authenticatable
class.
/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new App\Notifications\CustomResetPasswordNotification($token));
}
There are some other notifications you might want to overwrite whilst you're there such as the VerifyEmail
notification.
Regarding managing the content/layout in Nova, I suspect that is possible. You might need to write a custom package to read mardown
files is that's what you use in the email, either that or define some placeholders for text which can be stored in the database and managed via Nova.
Upvotes: 9