Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

477
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda