I am trying to setup Doctrine 2 Auth for a Laravel 5.3 app. I am using the Laravel generated Auth controllers so it's not my own custom implementation. I have made a few small changes (namely for persisting the user to the database using Doctrine) and got the registration working however when I try to login, it keeps failing authentication.
I have stepped through with a debugger and it seems to be consistently failing on the function hasValidCredentials (located at vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php) as detailed below:
/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
* @return bool
*/
public function check($value, $hashedValue, array $options = [])
{
if (strlen($hashedValue) === 0) {
return false;
}
return password_verify($value, $hashedValue);
}
For reference, my values for $value and $hashedValue are as follows:
$value = "tester";
$hashedValue = "$2y$10$ZSLRE3LAVA8myaH8mu6TNeumQxHdmKRbv/zZdFQeDujZ8JolshTOu";
A screenshot of the Variables as per my last XDebug session shows the exact type of the variables:
However when it hits password_verify, it always evaluates to false and then the hasValidCredentials check fails.
I am storing my user as follows in my database:
So I know that the hashed password is long enough and being stored in the database. I see that $hashedValue is returned in double quotes, could this be a problem?
Regardless I cannot login as the attempt function of the Session Guard class always fails as hasValidCredentials always returns false and I am quite stumped as the credentials are accurate.
Wondering if anyone has any ideas as to how to resolve this?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire