From 48291ca6ed118337c01451669675ef8880578f0c Mon Sep 17 00:00:00 2001 From: peintnermax Date: Wed, 11 Sep 2024 09:56:58 +0200 Subject: [PATCH] back button, error handling --- apps/login/src/ui/ChangePasswordForm.tsx | 4 ++-- apps/login/src/ui/RegisterFormWithoutPassword.tsx | 4 +--- apps/login/src/ui/SetPasswordForm.tsx | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/login/src/ui/ChangePasswordForm.tsx b/apps/login/src/ui/ChangePasswordForm.tsx index 77da28364e4..68ca8caee06 100644 --- a/apps/login/src/ui/ChangePasswordForm.tsx +++ b/apps/login/src/ui/ChangePasswordForm.tsx @@ -55,13 +55,13 @@ export default function ChangePasswordForm({ userId: userId, password: values.password, }).catch((error: Error) => { - setError(error.message ?? "Could not register user"); + setError(error.message ?? "Could not change password"); }); setLoading(false); if (!response) { - setError("Could not register user"); + setError("Could not change password"); return; } diff --git a/apps/login/src/ui/RegisterFormWithoutPassword.tsx b/apps/login/src/ui/RegisterFormWithoutPassword.tsx index 9ffcbb0b703..e5e76877232 100644 --- a/apps/login/src/ui/RegisterFormWithoutPassword.tsx +++ b/apps/login/src/ui/RegisterFormWithoutPassword.tsx @@ -89,9 +89,7 @@ export default function RegisterFormWithoutPassword({ if (withPassword) { return router.push(`/register?` + new URLSearchParams(registerParams)); } else { - const session = await submitAndRegister(value).catch((error) => { - setError(error.message ?? "Could not register user"); - }); + const session = await submitAndRegister(value); const params = new URLSearchParams({}); if (session?.factors?.user?.loginName) { diff --git a/apps/login/src/ui/SetPasswordForm.tsx b/apps/login/src/ui/SetPasswordForm.tsx index 97784c0b4fe..a76addeaa1b 100644 --- a/apps/login/src/ui/SetPasswordForm.tsx +++ b/apps/login/src/ui/SetPasswordForm.tsx @@ -12,6 +12,7 @@ import { useRouter } from "next/navigation"; import { useState } from "react"; import { FieldValues, useForm } from "react-hook-form"; import Alert from "./Alert"; +import BackButton from "./BackButton"; import { Button, ButtonVariants } from "./Button"; import { TextInput } from "./Input"; import PasswordComplexity from "./PasswordComplexity"; @@ -150,9 +151,7 @@ export default function SetPasswordForm({ {error && {error}}
- +