diff --git a/web/public/static/langs/en.json b/web/public/static/langs/en.json index 9c5793b6..c456aa3c 100644 --- a/web/public/static/langs/en.json +++ b/web/public/static/langs/en.json @@ -30,7 +30,8 @@ "login_link_signup": "Sign up", "login_link_forgot_password": "Forgot password", "reset_password_request_title": "Reset password", - "reset_password_request_description": "Enter your username or email address. If an account exists, a link to reset your password will be emailed. This only works if you already added a primary email address and verified it.", + "reset_password_request_description": "Enter your username or email address. If an account exists, a link to reset your password will be emailed.", + "reset_password_request_primary_required": "This only works if you already added a primary email address and verified it.", "reset_password_request_identifier_label": "Username or email", "reset_password_request_button_submit": "Send reset link", "reset_password_sent_title": "Check your inbox", @@ -41,7 +42,6 @@ "reset_password_form_password": "New password", "reset_password_form_confirm": "Confirm new password", "reset_password_form_button_submit": "Set password", - "reset_password_form_passwords_no_match": "Passwords do not match", "reset_password_form_error_invalid": "This reset link is invalid or has expired. Please request a new one.", "reset_password_success_title": "Password changed", "reset_password_success_description": "Your password has been changed. You can now sign in with your new password.", diff --git a/web/src/components/EmailVerify.jsx b/web/src/components/EmailVerify.jsx index d1f09783..8ada6886 100644 --- a/web/src/components/EmailVerify.jsx +++ b/web/src/components/EmailVerify.jsx @@ -9,6 +9,11 @@ import accountApi from "../app/AccountApi"; import AvatarBox from "./AvatarBox"; import routes from "./routes"; +// Verification states for the email-verify landing page +const STATUS_VERIFYING = "verifying"; +const STATUS_SUCCESS = "success"; +const STATUS_ERROR = "error"; + // EmailVerify is the magic-link landing page for email verification. It performs the verification // via a POST (the GET that loads this page has no side effects, so link prefetchers / scanners // cannot consume the single-use token). The raw token is stripped from the URL on load to keep @@ -17,7 +22,7 @@ const EmailVerify = () => { const { t } = useTranslation(); const { token } = useParams(); const navigate = useNavigate(); - const [status, setStatus] = useState("verifying"); // "verifying" | "success" | "error" + const [status, setStatus] = useState(STATUS_VERIFYING); const ran = useRef(false); useEffect(() => { @@ -30,23 +35,23 @@ const EmailVerify = () => { (async () => { try { await accountApi.verifyEmailToken(token); - setStatus("success"); + setStatus(STATUS_SUCCESS); } catch (e) { console.log(`[EmailVerify] Verification failed`, e); - setStatus("error"); + setStatus(STATUS_ERROR); } })(); }, [token]); return ( - {status === "verifying" && ( + {status === STATUS_VERIFYING && ( {t("email_verify_progress_title")} )} - {status === "success" && ( + {status === STATUS_SUCCESS && ( <> @@ -58,7 +63,7 @@ const EmailVerify = () => { )} - {status === "error" && ( + {status === STATUS_ERROR && ( <> diff --git a/web/src/components/PasswordReset.jsx b/web/src/components/PasswordReset.jsx index 4f9b857d..68a86eed 100644 --- a/web/src/components/PasswordReset.jsx +++ b/web/src/components/PasswordReset.jsx @@ -30,10 +30,6 @@ const PasswordReset = () => { const handleSubmit = async (event) => { event.preventDefault(); - if (password !== confirm) { - setError(t("reset_password_form_passwords_no_match")); - return; - } try { setSending(true); setError(""); @@ -91,7 +87,13 @@ const PasswordReset = () => { onChange={(ev) => setConfirm(ev.target.value.trim())} autoComplete="new-password" /> - {error && ( diff --git a/web/src/components/PasswordResetRequest.jsx b/web/src/components/PasswordResetRequest.jsx index 3a93ba14..f268dd62 100644 --- a/web/src/components/PasswordResetRequest.jsx +++ b/web/src/components/PasswordResetRequest.jsx @@ -65,7 +65,8 @@ const PasswordResetRequest = () => { {t("reset_password_request_title")} - {t("reset_password_request_description")} + {t("reset_password_request_description")} + {t("reset_password_request_primary_required")}