Show error message if login is blocked (#11331)

This commit is contained in:
Paulus Schoutsen 2022-01-16 21:20:23 -08:00 committed by GitHub
parent effec839af
commit 9fffc93e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,6 +162,11 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
this._errorMessage
)}
</ha-alert>
<div class="action">
<mwc-button raised @click=${this._startOver}>
${this.localize("ui.panel.page-authorize.form.start_over")}
</mwc-button>
</div>
`;
case "loading":
return html`
@ -339,6 +344,10 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
return this.localize("ui.panel.page-authorize.form.unknown_error");
}
private _startOver() {
this._providerChanged(this.authProvider);
}
private async _handleSubmit(ev: Event) {
ev.preventDefault();
if (this._step == null) {
@ -361,6 +370,12 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
const newStep = await response.json();
if (response.status === 403) {
this._state = "error";
this._errorMessage = newStep.message;
return;
}
if (newStep.type === "create_entry") {
this._redirect(newStep.result);
return;