Fix incorrect backup codes showing

This commit is contained in:
Jack Anderson 2024-12-06 11:26:22 +00:00
parent 5d96e6132b
commit 803c4f741c
2 changed files with 3 additions and 1 deletions

View file

@ -173,6 +173,7 @@ export class TwoFactorComponent implements OnInit {
}
public generateCodes(): void {
this.backupCodes = null;
this.generateBackupCodesService.generate().subscribe({
next: (response) => {
this.backupCodes = response?.data.backupCodes;
@ -197,6 +198,7 @@ export class TwoFactorComponent implements OnInit {
this.areRecoveryCodesGenerated.set(false)
this.generateCodes()
this.message.addSuccessMessageByKey('LBL_REGENERATED_BACKUP_CODES');
}).catch();
}

View file

@ -186,7 +186,7 @@ class SecurityController extends AbstractController
$this->userHandler->setUserPreference('is_two_factor_enabled', false);
$this->preparedStatementHandler->update(
'UPDATE users SET totp_secret = NULL, is_totp_enabled = 0 WHERE id = :id',
'UPDATE users SET totp_secret = NULL, is_totp_enabled = 0, backup_codes = NULL WHERE id = :id',
['id' => $id],
[['param' => 'id', 'type' => 'string']]
);