From a9a085ff786034e2027db5ce1728160ffc00b954 Mon Sep 17 00:00:00 2001 From: Fingertips Date: Mon, 23 Sep 2024 01:14:43 +0800 Subject: [PATCH] Consume forgot password api Redirect to reset password page if forgot password was successful, fix email template foreground color not setting correctly by adding '!important', correctly detect if local storage theme is undefined then set default theme and only add padding right to input component if it's a password. --- client/src/components/input.tsx | 9 +++++---- client/src/components/switch-auth.tsx | 4 ++-- client/src/lib/DTO/forgot-password-dto.ts | 3 --- client/src/lib/providers/theme-provider.tsx | 8 ++++---- client/src/lib/services/auth-service.ts | 12 +++++++++--- .../_components/forgot-password-form.tsx | 8 +++----- .../pages/sign-up/_components/sign-up-form.tsx | 4 ---- client/src/pages/sign-up/page.tsx | 9 ++++++++- .../verify-email/_components/resend-code.tsx | 5 ++++- .../_components/verify-email-form.tsx | 6 +++++- client/src/pages/verify-email/page.tsx | 17 +++++++++-------- templates/request_reset_password.go | 4 ++-- templates/success_reset_password.go | 4 ++-- templates/verify_email.go | 2 +- templates/welcome.go | 2 +- 15 files changed, 55 insertions(+), 42 deletions(-) delete mode 100644 client/src/lib/DTO/forgot-password-dto.ts diff --git a/client/src/components/input.tsx b/client/src/components/input.tsx index 9b55b8a..a45857e 100644 --- a/client/src/components/input.tsx +++ b/client/src/components/input.tsx @@ -40,7 +40,7 @@ const Input = ({ const [obscure, setObscure] = useState(true); const [valid, setValid] = useState(false); - const isPasswod = type === "password"; + const isPassword = type === "password"; const hasInput = value.length > 0; useEffect(() => { @@ -75,7 +75,7 @@ const Input = ({ setValue(e.target.value)} - type={isPasswod ? (obscure ? "password" : "text") : type} + type={isPassword ? (obscure ? "password" : "text") : type} placeholder={placeholder} autoComplete={autoComplete} id={name?.toLowerCase() ?? label.toLowerCase()} @@ -84,7 +84,8 @@ const Input = ({ required={required} maxLength={maxLength} className={`w-full md:w-[400px] bg-background py-2.5 rounded-lg outline-none border ring-1 focus:ring-2 transition-all - placeholder-foreground/50 px-11 disabled:bg-opacity-25 disabled:border-primary/25 disabled:text-foreground/50 disabled:pointer-events-none + placeholder-foreground/50 disabled:bg-opacity-25 disabled:border-primary/25 disabled:text-foreground/50 disabled:pointer-events-none + ${isPassword ? "px-11" : "pl-11"} ${ hasInput ? valid @@ -96,7 +97,7 @@ const Input = ({
- {isPasswod && ( + {isPassword && (