fix: merge conflicts

This commit is contained in:
Torsten Dittmann
2024-01-08 12:31:46 +01:00
parent 208abe17e7
commit bbf6480c15
2 changed files with 29 additions and 28 deletions
+1
View File
@@ -1205,6 +1205,7 @@ $collections = [
]
],
],
];
$commonCollections = [
'users' => [
+28 -28
View File
@@ -3292,18 +3292,18 @@ App::post('/v1/account/mfa/:provider')
$backups = Provider::generateBackupCodes();
switch ($provider) {
case 'totp':
if ($user->getAttribute('totp') && $user->getAttribute('totpVerification')) {
throw new Exception(Exception::GENERAL_UNKNOWN, 'TOTP already exists.');
}
$user
->setAttribute('totp', true)
->setAttribute('totpVerification', false)
->setAttribute('totpBackup', $backups)
->setAttribute('totpSecret', $otp->getSecret());
break;
}
switch ($provider) {
case 'totp':
if ($user->getAttribute('totp') && $user->getAttribute('totpVerification')) {
throw new Exception(Exception::GENERAL_UNKNOWN, 'TOTP already exists.');
}
$user
->setAttribute('totp', true)
->setAttribute('totpVerification', false)
->setAttribute('totpBackup', $backups)
->setAttribute('totpSecret', $otp->getSecret());
break;
}
$model = new Document();
$model
@@ -3351,20 +3351,20 @@ App::put('/v1/account/mfa/:provider')
default => false
};
if (!$success) {
throw new Exception(Exception::USER_INVALID_TOKEN);
}
if (!$success) {
throw new Exception(Exception::USER_INVALID_TOKEN);
}
switch ($provider) {
case 'totp':
if (!$user->getAttribute('totp')) {
throw new Exception(Exception::GENERAL_UNKNOWN, 'TOTP not added.');
} elseif ($user->getAttribute('totpVerification')) {
throw new Exception(Exception::GENERAL_UNKNOWN, 'TOTP already verified.');
}
$user->setAttribute('totpVerification', true);
break;
}
switch ($provider) {
case 'totp':
if (!$user->getAttribute('totp')) {
throw new Exception(Exception::GENERAL_UNKNOWN, 'TOTP not added.');
} elseif ($user->getAttribute('totpVerification')) {
throw new Exception(Exception::GENERAL_UNKNOWN, 'TOTP already verified.');
}
$user->setAttribute('totpVerification', true);
break;
}
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
@@ -3508,9 +3508,9 @@ App::put('/v1/account/mfa/challenge')
default => false
};
if (!$success) {
throw new Exception(Exception::USER_INVALID_TOKEN);
}
if (!$success) {
throw new Exception(Exception::USER_INVALID_TOKEN);
}
$dbForProject->deleteDocument('challenges', $challengeId);
$dbForProject->deleteCachedDocument('users', $user->getId());