From cd69c4c3618e828fa26556634f94b62b9813ae12 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 31 Dec 2024 17:48:34 +0100 Subject: [PATCH] Fix password incorrect check when restoring backup (#23525) --- src/panels/config/backup/dialogs/dialog-restore-backup.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/panels/config/backup/dialogs/dialog-restore-backup.ts b/src/panels/config/backup/dialogs/dialog-restore-backup.ts index 18a4b68a08..bcc6ecc7bf 100644 --- a/src/panels/config/backup/dialogs/dialog-restore-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-restore-backup.ts @@ -194,8 +194,9 @@ class DialogRestoreBackup extends LitElement implements HassDialog { this._userPassword || this._backupEncryptionKey ); } catch (e: any) { - this._unsubscribe(); + await this._unsubscribe(); if (e.code === "password_incorrect") { + this._error = undefined; this._step = "encryption"; } else { this._error = e.message; @@ -229,9 +230,11 @@ class DialogRestoreBackup extends LitElement implements HassDialog { private _unsubscribe() { window.removeEventListener("connection-status", this._connectionStatus); if (this._unsub) { - this._unsub.then((unsub) => unsub()); + const prom = this._unsub.then((unsub) => unsub()); this._unsub = undefined; + return prom; } + return undefined; } private _restoreState() {