Skip to content

Commit

Permalink
block invalid email
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed May 24, 2024
1 parent eb6a2e7 commit fc468df
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Module/Api/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public function authenticate(
RequestAssert::assert($A, 'Invalid credentials');
RequestAssert::assert($M1, 'Invalid credentials');

if (!str_contains($email, '@')) {
// Todo: Use email filters
throw new \RuntimeException('Invalid Email format');
}

$user = $orm->findOne(User::class, compact('email'));

if (!$user) {
Expand Down Expand Up @@ -200,6 +205,11 @@ public function register(

RequestAssert::assert($email, 'No Email');

if (!str_contains($email, '@')) {
// Todo: Use email filters
throw new \RuntimeException('Invalid Email format');
}

$verifier = BigInteger::fromBase($verifier, 16);
$salt = BigInteger::fromBase($salt, 16);

Expand Down

0 comments on commit fc468df

Please sign in to comment.