vendredi 7 décembre 2018

Laravel 5: Login password doesn't match with saved one

When I register a user, using Laravels built in controller Auth\RegisterController.php, everything works great and I'm immediately logged in. The problem is when I logout and try to login via Auth\LoginController.php, It shows that the password is incorrect. Code looks like this:

  • RegisterController.php

    $user = $this->create([
        'name' => $request['name'],
        'email' => $request['email'],
        'password' => Hash::make($request['password']),
    ]);
    
    
  • LoginController.php

    if(!Auth::attempt(request(['email', 'password']))) {
        return back()->withErrors([
            'message' => 'Wrong Emial or Password!'
        ]);
    }
    
    

I've checked the database and everything seems ok.

What is also weird about this problem, is when I hash the password ( using Hash::make('password') ) with php artisan tinker and then replace it in the database for the same user, everything works...



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2QCPdy9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire