mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
feat: address review comments
This commit is contained in:
@@ -876,12 +876,6 @@ App::patch('/v1/projects/:projectId/auth/mock-numbers')
|
||||
->inject('dbForConsole')
|
||||
->action(function (string $projectId, array $numbers, Response $response, Database $dbForConsole) {
|
||||
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$uniqueNumbers = [];
|
||||
foreach ($numbers as $number) {
|
||||
if (isset($uniqueNumbers[$number['phone']])) {
|
||||
@@ -889,6 +883,12 @@ App::patch('/v1/projects/:projectId/auth/mock-numbers')
|
||||
}
|
||||
$uniqueNumbers[$number['phone']] = $number['otp'];
|
||||
}
|
||||
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$auths = $project->getAttribute('auths', []);
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ class MockNumber extends Validator
|
||||
return false;
|
||||
}
|
||||
|
||||
$otp = new Text(6, 6);
|
||||
if (!$otp->isValid($value['otp']) || !\ctype_digit($value['otp'])) {
|
||||
$otp = new Text(6, 6, Text::NUMBERS);
|
||||
if (!$otp->isValid($value['otp'])) {
|
||||
$this->message = 'Invalid OTP. Please make sure the OTP is a 6 digit number';
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user