jeudi 28 janvier 2021

Two columns for password in Laravel for login

I have two password column one is password and other in temp_password, user can login with either password or temp_password for that i'm using following code:

if(Auth::attempt(['email' => request('email'), 'password' => request('password')])){ 
    echo "User Logged In";
} else if(Auth::attempt(['email' => request('email'), 'temp_password' => \Crypt::encrypt(request('password'))])) {
    echo "User Logged in";
} else {
    echo "Incorrect Credentials";
}

i'm getting this error :

Undefined index: password", exception: "ErrorException"

if i remove else if part it is working properly.

Any help is highly appreciated.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2KUocoY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire