Skip to content

Commit 2913193

Browse files
authored
Merge pull request #2152 from abhimanyu003/patch-1
Using filter_var to validate emails
2 parents d9db453 + adf3d19 commit 2913193

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/Http/Controllers/AuthController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Illuminate\Support\Facades\Request;
2323
use Illuminate\Support\Facades\Session;
2424
use Illuminate\Support\Facades\View;
25-
use Illuminate\Support\Str;
2625
use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA;
2726

2827
class AuthController extends Controller
@@ -48,7 +47,7 @@ public function postLogin()
4847
$loginData = Binput::only(['username', 'password']);
4948

5049
// Login with username or email.
51-
$loginKey = Str::contains($loginData['username'], '@') ? 'email' : 'username';
50+
$loginKey = filter_var($loginData['username'], FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
5251
$loginData[$loginKey] = array_pull($loginData, 'username');
5352

5453
// Validate login credentials.

0 commit comments

Comments
 (0)