diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index bbda98faa..8d4eb06ba 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -144,17 +144,25 @@ const Login = () => { } const resp = await getauthntemp(username()) handleResp(resp, async (data) => { - const options = parseRequestOptionsFromJSON(data.options) - const credentials = await get(options) - const resp = await postauthnlogin(data.session, credentials, username()) - handleRespWithoutNotify(resp, (data) => { - notify.success(t("login.success")) - changeToken(data.token) - to( - decodeURIComponent(searchParams.redirect || base_path || "/"), - true, + try { + const options = parseRequestOptionsFromJSON(data.options) + const credentials = await get(options) + const resp = await postauthnlogin( + data.session, + credentials, + username(), ) - }) + handleRespWithoutNotify(resp, (data) => { + notify.success(t("login.success")) + changeToken(data.token) + to( + decodeURIComponent(searchParams.redirect || base_path || "/"), + true, + ) + }) + } catch (error: unknown) { + if (error instanceof Error) notify.error(error.message) + } }) } } diff --git a/src/pages/manage/users/Profile.tsx b/src/pages/manage/users/Profile.tsx index 98b8c04be..c110f136c 100644 --- a/src/pages/manage/users/Profile.tsx +++ b/src/pages/manage/users/Profile.tsx @@ -282,7 +282,7 @@ const Profile = () => { return } const resp = await getauthntemp() - handleRespWithoutNotify(resp, async (data) => { + handleResp(resp, async (data) => { const options = parseCreationOptionsFromJSON(data.options) const session = data.session try {