once a user is logged into my application I want to give them the possibility to change their password. I have created three input fields (password_new, password_new_confirmation, password_old). In my form request I have the following rules but it doesn't work:
$rules['password_new'] = 'required|confirmed|min:6';
$rules['password_old'] = 'required|exists:users,password,email,'. Auth::user()->email;
This is perhaps because the password input is unhashed where as the stored password is in a hashed format?
So i'm thinking perhaps using the auth::validate facade as follows:
$valid = Auth::validate(['email' => Auth::user()->email, 'password' => Input::get('password_old')]);
if ( ! $valid)
{
// add error to validator
}
My question is how do i add the error to the validator instance inside my form request or overide the validator?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire