jeudi 18 juillet 2019

laravel. let user login with not unique email

I have users with unique username and not unique email (because one user can have multiple accounts).

Problem: Current login logic: user can login with username or email. But if email is not unique, default laravel auth select first record from database with that email and after that, check if password match (or something like that)

Is it good idea to override (somehow) default laravel login method and select from database record that match username and password hash. like this:

$user = User::where('email', $email)->where('password', Hash::make($password))->first();

or it is dumb solution and I should find another one?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire