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

192
Visualizações
Laravel | ask password for certain actions

I have a form in my Laravel project. And when a user tries to submit this form I want to show a dialog asking their password(for additional security). i.e I want the logged in user to enter his/her password when he/she wants to do some critical actions and verify that password.

I can figure out the front-end part of this but I don't know how to implement the controller logic for the same.

From documentation I found Auth::check() but it only checks if the current user is logged in or not.

How should I go about doing this?

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can ask logged in user for a password and then check it manually with check() method, for example:

if (Hash::check(request('password'), auth()->user()->password))

The first argument is a password entered by a user. The second argument is hashed password from DB.

about 4 years ago · Santiago Trujillo Relatório

0

I am actually planning to implement this on one of my websites. Lately, I have been going thought the planning and this is what I came through with:

  1. When user comes to the app, he/she logs in
  2. He/she adds some of the item to cart. The user has been already auth-ed, so this is not issue.
  3. When he/she tries to checkout, check for existence of very specific session item (e.g. REAUTH_SUCCESS) and if such existed, proceed. Otherwise, go back and print login form with password field alone. After this, it is just matter of doing what @Alexey and @Robert suggested in their answers.

Hope this helps.

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