Reputation: 223
I need to overwrite error message if password reset token was expired. Bu default it shows 'The password reset token is invalid' but I need different text instead. I work with Laravel 5.6
I've tried to find how to do it, but no any info here or on the official documentation found.
Help or tips where to read about are very appreciated!
Upvotes: 1
Views: 656
Reputation: 582
In blade template, Instead of
@if ($errors->has(field))
<span class="help-block">
<strong>{{ $errors->first(field) }}</strong>
</span>
@endif
you can use this
@if ($errors->has(field))
<span class="help-block">
<strong>{{ sprintf('Error Message')}}</strong>
</span>
@endif
Upvotes: 1
Reputation: 6646
You can find the translation string in the file located in resources/lang/en/passwords.php
.
This also ensures that you can translate this string for other languages you use.
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
Upvotes: 1