diff --git a/web/helpers/authentication.helper.tsx b/web/helpers/authentication.helper.tsx index f6bbe7788..0e05fb0f5 100644 --- a/web/helpers/authentication.helper.tsx +++ b/web/helpers/authentication.helper.tsx @@ -248,7 +248,7 @@ const errorCodeMessages: { // Reset Password [EAuthenticationErrorCodes.INVALID_PASSWORD_TOKEN]: { title: `Invalid password token`, - message: () => `Invalid password token. Please try again.`, + message: () => `Invalid password token.`, }, [EAuthenticationErrorCodes.EXPIRED_PASSWORD_TOKEN]: { title: `Expired password token`, diff --git a/web/pages/accounts/reset-password.tsx b/web/pages/accounts/reset-password.tsx index ee076c6c8..6e1af074a 100644 --- a/web/pages/accounts/reset-password.tsx +++ b/web/pages/accounts/reset-password.tsx @@ -7,10 +7,16 @@ import { Eye, EyeOff } from "lucide-react"; // ui import { Button, Input } from "@plane/ui"; // components -import { PasswordStrengthMeter } from "@/components/account"; +import { AuthBanner, PasswordStrengthMeter } from "@/components/account"; import { PageHead } from "@/components/core"; // helpers -import { EPageTypes } from "@/helpers/authentication.helper"; +import { + EAuthenticationErrorCodes, + EErrorAlertType, + EPageTypes, + TAuthErrorInfo, + authErrorHandler, +} from "@/helpers/authentication.helper"; import { API_BASE_URL } from "@/helpers/common.helper"; import { getPasswordStrength } from "@/helpers/password.helper"; // layouts @@ -43,7 +49,7 @@ const authService = new AuthService(); const ResetPasswordPage: NextPageWithLayout = () => { // router const router = useRouter(); - const { uidb64, token, email } = router.query; + const { uidb64, token, email, error_code } = router.query; // states const [showPassword, setShowPassword] = useState({ password: false, @@ -56,6 +62,7 @@ const ResetPasswordPage: NextPageWithLayout = () => { const [csrfToken, setCsrfToken] = useState(undefined); const [isPasswordInputFocused, setIsPasswordInputFocused] = useState(false); const [isRetryPasswordInputFocused, setIsRetryPasswordInputFocused] = useState(false); + const [errorInfo, setErrorInfo] = useState(undefined); // hooks const { resolvedTheme } = useTheme(); @@ -81,6 +88,15 @@ const ResetPasswordPage: NextPageWithLayout = () => { [resetFormData] ); + useEffect(() => { + if (error_code) { + const errorhandler = authErrorHandler(error_code?.toString() as EAuthenticationErrorCodes); + if (errorhandler) { + setErrorInfo(errorhandler); + } + } + }, [error_code]); + return (
@@ -106,6 +122,9 @@ const ResetPasswordPage: NextPageWithLayout = () => {

Secure your account with a strong password

+ {errorInfo && errorInfo?.type === EErrorAlertType.BANNER_ALERT && ( + setErrorInfo(value)} /> + )}