diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index 00070a57b664..fb1d7d7c32f5 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -21,7 +21,6 @@ import { DataEntryFlowStepForm, } from "../data/data_entry_flow"; import "./ha-auth-form"; -import { fireEvent } from "../common/dom/fire_event"; type State = "loading" | "error" | "step"; @@ -39,7 +38,9 @@ export class HaAuthFlow extends LitElement { @property({ attribute: false }) public step?: DataEntryFlowStep; - @property({ type: Boolean }) private storeToken = false; + @property({ type: Boolean }) private initStoreToken = false; + + @state() private _storeToken = false; @state() private _state: State = "loading"; @@ -56,6 +57,10 @@ export class HaAuthFlow extends LitElement { willUpdate(changedProps: PropertyValues) { super.willUpdate(changedProps); + if (!this.hasUpdated) { + this._storeToken = this.initStoreToken; + } + if (!changedProps.has("step")) { return; } @@ -155,11 +160,6 @@ export class HaAuthFlow extends LitElement { } private _renderForm() { - const showBack = - this.step?.type === "form" && - this.authProvider?.users && - !["select_mfa_module", "mfa"].includes(this.step.step_id); - switch (this._state) { case "step": if (this.step == null) { @@ -168,12 +168,7 @@ export class HaAuthFlow extends LitElement { return html` ${this._renderStep(this.step)} -
${this.localize("ui.panel.page-authorize.initializing")}
` - : !this._forceDefaultLogin && - this._authProvider!.users && - this.clientId != null && - this.redirectUri != null - ? html`