Show an appropriate message when a user can not sign into his account

This commit is contained in:
Pierre HUBERT 2021-05-14 15:36:09 +02:00
parent 9b0f3c1fec
commit cc26bab72e

View File

@ -28,7 +28,7 @@ import {
} from "../../helpers/AccountHelper";
import { input, matAlert } from "../widgets/DialogsProvider";
function ErrorGettingOptions() {
function ErrorGettingOptions(p: { message: string }) {
return (
<Paper
style={{
@ -40,7 +40,7 @@ function ErrorGettingOptions() {
}}
>
<ErrorOutline></ErrorOutline>
&nbsp; Could not get your auth options!
&nbsp; {p.message}
</Paper>
);
}
@ -180,7 +180,7 @@ export class LoginRoute extends React.Component<{}, LoginRouteState> {
{/* Login error (if any) */}
{this.state.errorGettingAuthOptions ? (
ErrorGettingOptions()
<ErrorGettingOptions message="Could not get your auth options!" />
) : (
<div></div>
)}
@ -265,6 +265,15 @@ class AuthOptionsWidget extends React.Component<
}
render() {
// Check if no option is available
if (
this.props.options.keys.length == 0 &&
!this.props.options.reset_token
)
return (
<ErrorGettingOptions message="You have no way to access your account right now!" />
);
return (
<Paper style={{ width: "100%", marginTop: "10px" }}>
<List style={{ width: "100%" }}>