From 3421627f31f6d21c359a68487723880a21616103 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 4 May 2026 14:12:56 +0500 Subject: [PATCH 01/39] mobile: show error if passwords do not match or fields empty --- apps/mobile/app/components/auth/signup.tsx | 42 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/apps/mobile/app/components/auth/signup.tsx b/apps/mobile/app/components/auth/signup.tsx index d3ae56f3a..d936ad17c 100644 --- a/apps/mobile/app/components/auth/signup.tsx +++ b/apps/mobile/app/components/auth/signup.tsx @@ -46,6 +46,8 @@ import { AuthHeader } from "./header"; import { SignupContext } from "./signup-context"; import { RouteParams } from "../../stores/use-navigation-store"; import SettingsService from "../../services/settings"; +import AppIcon from "../ui/AppIcon"; +import isEmail from "validator/lib/isEmail"; const SignupSteps = { signup: 0, @@ -69,6 +71,7 @@ export const Signup = ({ const confirmPasswordInputRef = useRef(null); const confirmPassword = useRef(undefined); const [error, setError] = useState(false); + const [errorMessage, setErrorMessage] = useState(); const [loading, setLoading] = useState(false); const setUser = useUserStore((state) => state.setUser); const setLastSynced = useUserStore((state) => state.setLastSynced); @@ -78,13 +81,17 @@ export const Signup = ({ const validateInfo = () => { if (!password.current || !email.current || !confirmPassword.current) { - ToastManager.show({ - heading: strings.allFieldsRequired(), - message: strings.allFieldsRequiredDesc(), - type: "error", - context: "local" - }); + setErrorMessage(strings.allFieldsRequiredDesc()); + return false; + } + if (!isEmail(email.current)) { + setErrorMessage(strings.emailInvalid()); + return false; + } + + if (password.current !== confirmPassword.current) { + setErrorMessage(strings.passwordNotMatched()); return false; } @@ -92,6 +99,7 @@ export const Signup = ({ }; const signup = async () => { + setErrorMessage(undefined); if (!validateInfo() || error) return; if (loading) return; @@ -277,6 +285,7 @@ export const Signup = ({ blurOnSubmit={false} validationType="confirmPassword" customValidator={() => password.current || ""} + errorMessage={strings.passwordNotMatched()} placeholder={strings.confirmPassword()} marginBottom={12} onSubmit={() => { @@ -285,7 +294,7 @@ export const Signup = ({ />