#Laravel 9 Auth problem
43 messages · Page 1 of 1 (latest)
Enter the correct credentials. Maybe.
i did ..
Is your database connected?
class LoginController extends Controller
{
public function index(){
return view('login');
}
public function logout(){
Session::flush();
Auth::logout();
return redirect('login');
}
public function validate_login(Request $request){
$credentials = $request->validate([
'email' => 'required|exists:users,email',
'password' => 'required'
]);
// $credentials['password'] = bcrypt($credentials['password']);
if (Auth::attempt($credentials)){
dd("i am in");
}else{
dd("i am not in");
}
exit;
throw ValidationException::withMessages([
'email' => 'Your provided crednetials could not be verified.',
'password' => 'Password didn`t match'
]);
}
}
yup
😄 was building up a joke for the missing code. You've ruined it!
You should not hash the password specified as the password value, since the framework will automatically hash the value before comparing it to the hashed password in the database.
yes is read that part later
but it is strange that i wont get inside the if statement
even though my credentials are correct
Oh, I didn't see that you've commented out that line
Well, then your validation is not passing.
Try to dump something before you validate, or remove it temporarily
Yes, of course
ah ok, does laravel uses md5 hash
I hope not
or doesn't it matteR?
You should read some docs man
Ur high
i really do
In your database: HASH IT
When doing Auth::attempt do NOT hash it
ok understandable
Storing plain passwords is baaaad
The example in the docs also addresses this
we're the dynamic duo
tag it as solved, or close it, up to you
I'm Batman and @grave atlas is my robin