Hi I am using Laravel to create my web app. I have a table named buyerData in which I have two columns that are designed to store Password. Their names are,
1- Password 2- buyerData_fb_password
Now the issue I am facing the laravel be default thinks the column which contains password in your table is named as "Password". But in my case I have another column. How can I tweak the laravel framework to accept both columns as password, depends upon the column that is used at a given time.
For example the below code is working fine because it is using the default column "password".
if (Auth::guard('buyer')->attempt(['buyerData_primaryEmail' => $userEmail,
'password' => $unhashPass]));
But the below code is not working as expected because its use the other column name "buyerData_fb_password" and shows the error. (Shown below after code).
if (Auth::guard('buyer')->attempt(['buyerData_primaryEmail' => $userEmail,
'buyerData_fb_password' => $unhashPass]));
Shows this error
I tweaked the validateCredentials() function a little bit and made the following changes,
public function validateCredentials(UserContract $user, array $credentials) {
if (isset($credentials['password']))
{
$plain = $credentials['password'];
}
else
{
$plain = $credentials['buyerData_fb_password'];
}
return $this->hasher->check($plain, $user->getAuthPassword());
}
After this the code is working with "buyerData_fb_password" and login is successfull but it if I visit any other page in my website then it shows that the user is not login. Any suggestion? Thanks
via Chebli Mohamed

Aucun commentaire:
Enregistrer un commentaire