few bugfixes, fido/u2f still WIP

This commit is contained in:
2024-04-07 18:29:33 +02:00
parent 0974ac9260
commit 6c551b08d8
19 changed files with 164 additions and 67 deletions

View File

@@ -47,10 +47,14 @@ export default class API {
}
let res = await response.json();
if (!res.success && res.loggedIn === false) {
this.loggedIn = false;
this.user = null;
this.session = null;
if (!res.success) {
if (res.loggedIn === false) {
this.loggedIn = false;
this.user = null;
this.session = null;
} else if (res.twoFactorToken === true) {
this.user.twoFactorToken = res.twoFactorToken;
}
}
return res;

View File

@@ -138,6 +138,7 @@ export default function LoginForm(props) {
type: "public-key",
}],
userVerification: "discouraged",
attestation: "direct",
},
signal: abortSignal
}).then((res) => {
@@ -207,7 +208,7 @@ export default function LoginForm(props) {
<Box mt={2} textAlign={"center"}>
{tfaToken.step !== 2
? <CircularProgress/>
: <Box>
: <Box mb={2}>
<div><b>{L("general.something_went_wrong")}:</b><br />{tfaToken.error}</div>
<Button onClick={() => set2FAToken({ ...tfaToken, step: 0, error: "" })}
variant={"outlined"} color={"secondary"} size={"small"}>