Answer the question
In order to leave comments, you need to log in
Why is the password not validating (Laravel 5.8)?
Hello.
I am "writing" a training project in Laravel 5.8. On the Vuejs front.
For authorization and authentication I use JWT Tymon.
The essence of the problem lies in the fact that at the start he created the user "Admin". And during the development of the project, he used it.
Now faced with the fact that the created new users do not pass authorization. Those. The user is created and entered into the database with a hashed password. But the created user does not pass authorization! If the created password for this user is replaced with the password "Admin" - logs in without questions.
I understand that the problem is not in password validation during authorization, as the old password passes it (validation), but in hashing a new password when creating new users. I tried to change the functions and hashing algorithms - it does not help. I think it has something to do with salt.
Guys, kick in the right direction - where and what to tweak, what would "work"?
Answer the question
In order to leave comments, you need to log in
Maybe due to the fact that in 5.8 the minimum number of characters in the password became 8?
Solution found.
While "playing" with packages, I added a method to the User model
public function setPasswordAttribute($password)
{
if (!empty($password)) {
$this->attributes['password'] = bcrypt($password);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question