How to implement independent password modification with Laravel's own auth verification

WBOY
Release: 2016-07-06 13:54:10
Original
1184 people have browsed it

Problem: The auth verification that comes with laravel only has the password retrieval function (send email, reset password), and now what I want is the function of changing the password independently, that is, how to change the user's input of the old password to a new password. In fact, I also know this logic, but I'm only stuck on one step: how to verify the password encryption that comes with auth? I use:

bcrypt(input('old_password')) == old_password

But it keeps false, what should I do? Solve.

Reply content:

Problem: The auth verification that comes with laravel only has the password retrieval function (send email, reset password), and now what I want is the function of changing the password independently, that is, how to change the user's input of the old password to a new password. In fact, I also know this logic, but I'm only stuck on one step: how to verify the password encryption that comes with auth? I use:

bcrypt(input('old_password')) == old_password

But it keeps false, what should I do? Solve.

Your question: How to verify the password encryption that comes with auth?
Answer: Hash::check(Request::input('old_password'), $old_password)
(where $old_password is the old hashed password taken from the database)
Related document link: Hashing

The hashed password generated by the bcrypt function for the same plaintext password is different because it is used differently every time salt

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!