mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-24 09:13:45 +02:00
webauthn: update login flow to support other 2fa methods
This commit is contained in:
@@ -39,19 +39,37 @@ const LoginContainer = ({ history }: RouteComponentProps) => {
|
||||
setSubmitting(false);
|
||||
clearAndAddHttpError({ error });
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
login({ ...values, recaptchaData: token })
|
||||
.then(response => {
|
||||
console.log('wow!');
|
||||
console.log(response);
|
||||
if (response.complete) {
|
||||
console.log(`Redirecting to: ${response.intended || '/'}`);
|
||||
// @ts-ignore
|
||||
window.location = response.intended || '/';
|
||||
return;
|
||||
}
|
||||
|
||||
history.replace('/auth/login/checkpoint', { token: response.confirmationToken });
|
||||
if (response.methods?.includes('webauthn')) {
|
||||
console.log('Redirecting to: /auth/login/key');
|
||||
history.replace('/auth/login/key', {
|
||||
token: response.confirmationToken,
|
||||
publicKey: response.publicKey,
|
||||
hasTotp: response.methods.includes('totp'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.methods?.includes('totp')) {
|
||||
console.log('/auth/login/checkpoint');
|
||||
history.replace('/auth/login/checkpoint', { token: response.confirmationToken });
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('huh?');
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user