If a user enters a wrong email when trying to reset a password, he receives an error message "passwords.user". I'm trying to override the methods of rules and messages of trait Auth/ResetsPasswords.php but my user gets all the same message

This is my controller

class ResetPasswordController extends Controller
{

    use ResetsPasswords;

    public function __construct()
    {
        $this->middleware('guest');
    }

    protected function rules()
    {
        return [
            'email' => 'exists:users.email',
        ];
    }

    protected function validationErrorMessages()
    {
        return [
            'email.exists' => 'The email is not registered',
        ];
    }
}

trait method does not contain key 'passwords.user'

protected function rules()
{
    return [
        'token' => 'required',
        'email' => 'required|email',
        'password' => 'required|confirmed|min:6',
    ];
}

but it is in the folder config/auth

'defaults' => [
    'guard' => 'web',
    'passwords' => 'users',
],

How can I add my own rules and error messages when resetting password?

1 Answers

0
Leonardo Rossi On Best Solutions

Edit: I have corrected the previous answer, because I was pointing to the wrong file

The file you are looking for, to translate your message is in resources/lang/en/passwords.php and there you can customize che 'user' entry.

Of course if en is not your current locale, change that directory to your language