#1074 Add country select for login

This commit is contained in:
Diatrex 2020-03-17 10:51:47 +03:00
parent edba0f4fba
commit 40eb52cca3

View File

@ -43,7 +43,13 @@ class ValidateCredentials
//Is email or phone number
if (!filter_var($credentials['email'], FILTER_VALIDATE_EMAIL)) {
if ($user = $this->repository->findBy('gsm_phone', $credentials['email'])) {
$possiblePhone = $credentials['email'];
if (substr($credentials['email'], 0, 1) == 0) {
$possiblePhone = substr($credentials['email'], 1);
}
if ($user = $this->repository
->newQuery()
->where('gsm_phone', 'LIKE', "%$possiblePhone")->first()) {
$credentials['email'] = $user->email;
}
}