mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Show an error when invalid client id or redirect uri (#1620)
This commit is contained in:
parent
68b3a4fbb7
commit
bf40995b16
@ -16,13 +16,16 @@ class HaAuthFlow extends LocalizeLiteMixin(PolymerElement) {
|
|||||||
margin: 24px 0 8px;
|
margin: 24px 0 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.error {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<form>
|
<form>
|
||||||
<template is="dom-if" if="[[_equals(_state, "loading")]]">
|
<template is="dom-if" if="[[_equals(_state, "loading")]]">
|
||||||
[[localize('ui.panel.page-authorize.form.working')]]:
|
[[localize('ui.panel.page-authorize.form.working')]]:
|
||||||
</template>
|
</template>
|
||||||
<template is="dom-if" if="[[_equals(_state, "error")]]">
|
<template is="dom-if" if="[[_equals(_state, "error")]]">
|
||||||
[[localize('ui.panel.page-authorize.form.unknown_error')]]:
|
<div class='error'>Error: [[_errorMsg]]</div>
|
||||||
</template>
|
</template>
|
||||||
<template is="dom-if" if="[[_equals(_state, "step")]]">
|
<template is="dom-if" if="[[_equals(_state, "step")]]">
|
||||||
<template is="dom-if" if="[[_equals(_step.type, "abort")]]">
|
<template is="dom-if" if="[[_equals(_step.type, "abort")]]">
|
||||||
@ -74,7 +77,8 @@ class HaAuthFlow extends LocalizeLiteMixin(PolymerElement) {
|
|||||||
_step: {
|
_step: {
|
||||||
type: Object,
|
type: Object,
|
||||||
notify: true,
|
notify: true,
|
||||||
}
|
},
|
||||||
|
_errorMsg: String,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,12 +111,23 @@ class HaAuthFlow extends LocalizeLiteMixin(PolymerElement) {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const step = await response.json();
|
const data = await response.json();
|
||||||
this._updateStep(step);
|
|
||||||
|
if (response.ok) {
|
||||||
|
this._updateStep(data);
|
||||||
|
} else {
|
||||||
|
this.setProperties({
|
||||||
|
_state: 'error',
|
||||||
|
_errorMsg: data.message,
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.error('Error starting auth flow', err);
|
console.error('Error starting auth flow', err);
|
||||||
this._state = 'error';
|
this.setProperties({
|
||||||
|
_state: 'error',
|
||||||
|
_errorMsg: this.localize('ui.panel.page-authorize.form.unknown_error'),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@ class HaAuthorize extends LocalizeLiteMixin(PolymerElement) {
|
|||||||
static get template() {
|
static get template() {
|
||||||
return html`
|
return html`
|
||||||
<style>
|
<style>
|
||||||
|
ha-markdown {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
ha-markdown a {
|
ha-markdown a {
|
||||||
color: var(--primary-color);
|
color: var(--primary-color);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user