Search
View: 115|Reply: 3

How to generate and validate a random (and temporary) password in Laravel?

[ Promote this link! ]

13

!threads!

0

Friends

197

Money

member

Rank: 1

Post time 2024-10-30 16:51:18 |Show all posts
I need to implement a method to generate a random password and then validate that the user is using the password previously generated. I really appreciate any help and guidance. Thank you all!

13

!threads!

0

Friends

197

Money

member

Rank: 1

Post time 2024-10-30 16:56:24 |Show all posts
Edited by Stevyamda at 2024-10-30 16:59

I need to implement a method to generate a random password and then validate that the user is using the password previously generated. I really appreciate any help and guidance. Thank you all!

0

!threads!

0

Friends

4

Money

member

Rank: 1

Post time 2024-10-30 17:00:53 |Show all posts
Use the standard authentication and give the user a random password...

0

!threads!

0

Friends

14

Money

member

Rank: 1

Post time 2024-10-30 17:02:10 |Show all posts
Edited by JazmynParker at 2024-11-1 17:52

I used Str::random() to generate a random password—usually something like Str::random(12) for 12 characters. If you’re storing it in the database, just make sure to hash it so it’s secure. When the user enters the password, you can check it against the hashed one in the database.Sometimes, I use an online password generator to make sure the password is really random and strong. It’s a quick way to get tough passwords without a lot of extra steps. So, I think that you should check it out. Or, if you want to skip generating passwords entirely, sending a password reset link lets users set their own securely, which can save a step.
You have to log in before you can reply Login | 立即注册

Heyshell

2024-12-8 20:21 GMT+8 , Processed in 0.037638 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

To Top