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"; } from "../../helpers/AccountHelper";
import { input, matAlert } from "../widgets/DialogsProvider"; import { input, matAlert } from "../widgets/DialogsProvider";
function ErrorGettingOptions() { function ErrorGettingOptions(p: { message: string }) {
return ( return (
<Paper <Paper
style={{ style={{
@ -40,7 +40,7 @@ function ErrorGettingOptions() {
}} }}
> >
<ErrorOutline></ErrorOutline> <ErrorOutline></ErrorOutline>
&nbsp; Could not get your auth options! &nbsp; {p.message}
</Paper> </Paper>
); );
} }
@ -180,7 +180,7 @@ export class LoginRoute extends React.Component<{}, LoginRouteState> {
{/* Login error (if any) */} {/* Login error (if any) */}
{this.state.errorGettingAuthOptions ? ( {this.state.errorGettingAuthOptions ? (
ErrorGettingOptions() <ErrorGettingOptions message="Could not get your auth options!" />
) : ( ) : (
<div></div> <div></div>
)} )}
@ -265,6 +265,15 @@ class AuthOptionsWidget extends React.Component<
} }
render() { 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 ( return (
<Paper style={{ width: "100%", marginTop: "10px" }}> <Paper style={{ width: "100%", marginTop: "10px" }}>
<List style={{ width: "100%" }}> <List style={{ width: "100%" }}>