Fix password incorrect check when restoring backup (#23525)

This commit is contained in:
Bram Kragten 2024-12-31 17:48:34 +01:00 committed by GitHub
parent eaab47a667
commit cd69c4c361
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,8 +194,9 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
this._userPassword || this._backupEncryptionKey this._userPassword || this._backupEncryptionKey
); );
} catch (e: any) { } catch (e: any) {
this._unsubscribe(); await this._unsubscribe();
if (e.code === "password_incorrect") { if (e.code === "password_incorrect") {
this._error = undefined;
this._step = "encryption"; this._step = "encryption";
} else { } else {
this._error = e.message; this._error = e.message;
@ -229,9 +230,11 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
private _unsubscribe() { private _unsubscribe() {
window.removeEventListener("connection-status", this._connectionStatus); window.removeEventListener("connection-status", this._connectionStatus);
if (this._unsub) { if (this._unsub) {
this._unsub.then((unsub) => unsub()); const prom = this._unsub.then((unsub) => unsub());
this._unsub = undefined; this._unsub = undefined;
return prom;
} }
return undefined;
} }
private _restoreState() { private _restoreState() {