Mustafa Nure Alam
Mustafa Nure Alam

Reputation: 133

I can't change the user's password

If I want to change the password, the codes are working properly, do not show any mistakes, but it looks incorrect if you want to log in with a 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();
}

Upvotes: 3

Views: 60

Answers (1)

Saifur Rahman
Saifur Rahman

Reputation: 455

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

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

Upvotes: 2

Related Questions