I cannot change user password

If I want to change the password, the codes are working correctly, do not show errors, but it looks wrong if you want to log in with the new password. I saw in the database, there was no password change.

public function postPasswordReset(Request $request)
{
    $validator = validator::make($request->all(), [
            'email'     =>  'required|exists:users,email',
            'password' => 'required|alpha_num|between:6,32',
            're-password' => 'required|same:password'
        ]);

    if($validator->passes()){

        $user = User::where('email', $request->email)->first();
        $user->update(['password' bcrypt($request->password)]);

        return redirect()->route('auth.login');
    }
     return redirect()->back()->withErrors($validator->errors())-
     >withInput();
}

      

+3


source to share


1 answer


In your update method, you are using an array to update in the wrong format. Try this



$user->update(['password' => bcrypt($request->password)]);

      

+2


source







All Articles