1
0
Fork 0
mirror of synced 2024-09-30 01:08:13 +13:00

formatting fix

This commit is contained in:
Damodar Lohani 2022-12-26 05:47:20 +00:00
parent 124403b804
commit e9710bdb76
3 changed files with 21 additions and 13 deletions

View file

@ -99,10 +99,12 @@ App::post('/v1/account')
}
}
if(str_contains($passwordsDB, $password)) {
throw new Exception(Exception::USER_PASSWORD_IN_DICTIONARY,
if (str_contains($passwordsDB, $password)) {
throw new Exception(
Exception::USER_PASSWORD_IN_DICTIONARY,
'The password is among the common passwords in dictionary.',
403);
403
);
}
$passwordHistory = $project->getAttribute('auths', [])['passwordHistory'] ?? 0;
@ -1533,10 +1535,12 @@ App::patch('/v1/account/password')
throw new Exception(Exception::USER_INVALID_CREDENTIALS);
}
if(str_contains($passwordsDB, $password)) {
throw new Exception(Exception::USER_PASSWORD_IN_DICTIONARY,
if (str_contains($passwordsDB, $password)) {
throw new Exception(
Exception::USER_PASSWORD_IN_DICTIONARY,
'The password is among the common passwords in dictionary.',
403);
403
);
}
$newPassword = Auth::passwordHash($password, Auth::DEFAULT_ALGO, Auth::DEFAULT_ALGO_OPTIONS);

View file

@ -114,10 +114,12 @@ App::post('/v1/users')
->inject('events')
->action(function (string $userId, ?string $email, ?string $phone, ?string $password, string $name, string $passwordsDB, Response $response, Document $project, Database $dbForProject, Event $events) {
if(str_contains($passwordsDB, $password)) {
throw new Exception(Exception::USER_PASSWORD_IN_DICTIONARY,
if (str_contains($passwordsDB, $password)) {
throw new Exception(
Exception::USER_PASSWORD_IN_DICTIONARY,
'The password is among the common passwords in dictionary.',
403);
403
);
}
$user = createUser('plaintext', '{}', $userId, $email, $password, $phone, $name, $project, $dbForProject, $events);
@ -813,10 +815,12 @@ App::patch('/v1/users/:userId/password')
throw new Exception(Exception::USER_NOT_FOUND);
}
if(str_contains($passwordsDB, $password)) {
throw new Exception(Exception::USER_PASSWORD_IN_DICTIONARY,
if (str_contains($passwordsDB, $password)) {
throw new Exception(
Exception::USER_PASSWORD_IN_DICTIONARY,
'The password is among the common passwords in dictionary.',
403);
403
);
}
$newPassword = Auth::passwordHash($password, Auth::DEFAULT_ALGO, Auth::DEFAULT_ALGO_OPTIONS);

View file

@ -1174,7 +1174,7 @@ class ProjectsConsoleClientTest extends Scope
]);
$this->assertEquals(403, $response['headers']['status-code']);
/**
* Create user
*/