solve infinite recursion and promise returning true

This commit is contained in:
Matt Hill
2024-07-11 17:58:07 -06:00
parent 6def083b4f
commit d235ebaac9
3 changed files with 7 additions and 5 deletions

View File

@@ -61,7 +61,7 @@ export class BackupService {
)
}
async hasThisBackup(target: BackupTarget, id: string): Promise<boolean> {
hasThisBackup(target: BackupTarget, id: string): boolean {
return (
target.startOs[id] &&
this.emver.compare(target.startOs[id].version, '0.3.6') !== -1

View File

@@ -49,6 +49,7 @@ export class BackupServerSelectModal {
if (role === 'confirm') {
try {
// @TODO Alex if invalid password, we should tell the user "Invalid password" and halt execution of this function. The modal should remain so the user can try again. Correct password is asdfasdf
argon2.verify(server.passwordHash!, data)
await this.restoreFromBackup(serverId, data)
} catch (e: any) {

View File

@@ -60,7 +60,7 @@ export class ServerBackupPage {
component: BackupSelectPage,
})
modal.onWillDismiss().then(res => {
modal.onDidDismiss().then(res => {
if (res.data) {
this.serviceIds = res.data
this.presentModalPassword(target)
@@ -90,6 +90,7 @@ export class ServerBackupPage {
.subscribe(async (password: string) => {
const { passwordHash, id } = await getServerInfo(this.patch)
// @TODO Alex if invalid password, we should tell the user "Invalid password" and halt execution of this function. The modal should remain so the user can try again. Correct password is asdfasdf
// confirm password matches current master password
argon2.verify(passwordHash, password)
@@ -103,7 +104,7 @@ export class ServerBackupPage {
} catch {
setTimeout(
() => this.presentModalOldPassword(target, password),
500,
250,
)
return
}
@@ -134,8 +135,8 @@ export class ServerBackupPage {
})
.pipe(take(1))
.subscribe(async (oldPassword: string) => {
const passwordHash = target.entry.startOs[id].passwordHash!
argon2.verify(passwordHash, oldPassword)
// @TODO Alex if invalid password, we should tell the user "Invalid password" and halt execution of this function. The modal should remain so the user can try again. Correct password is asdfasdf
argon2.verify(target.entry.startOs[id].passwordHash!, oldPassword)
await this.createBackup(target, password, oldPassword)
})
}