Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

483
Vistas
How do I check if Bcrypt password is correct?

I was using md5 to hash my passwords but learned that using bcrypt was more secure.

When using md5, it was easy to check whether a password entered in a form was correct. I simply done

if(md5($request->password) == $user->password)
   //Login or whatever

So how do I do this using bcrypt? I tried

if(bcrypt($request->password) == $user->password)

But that isn't working.

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Use the attempt() method:

if (Auth::attempt(['email' => $email, 'password' => $password]))

The attempt method accepts an array of key/value pairs as its first argument. The values in the array will be used to find the user in your database table.

https://laravel.com/docs/5.4/authentication#authenticating-users

Under the hood attempt() uses password_verify() method to check password.

about 4 years ago · Santiago Trujillo Denunciar

0

You could also use the check method of the Hash Facade

if (Hash::check($request->password, $user->password)) {
    // The passwords match...
}

https://laravel.com/docs/5.4/hashing#basic-usage

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda