diff --git a/frontend/src/pages/GeneralSettings/Security/index.jsx b/frontend/src/pages/GeneralSettings/Security/index.jsx index 0bf6aec9..6a37b113 100644 --- a/frontend/src/pages/GeneralSettings/Security/index.jsx +++ b/frontend/src/pages/GeneralSettings/Security/index.jsx @@ -199,7 +199,7 @@ function MultiUserMode() { ); } -const PW_REGEX = new RegExp(/^[a-zA-Z0-9_\-!@$%^&*();]+$/); +export const PW_REGEX = new RegExp(/^[a-zA-Z0-9_\-!@$%^&*();]+$/); function PasswordProtection() { const [saving, setSaving] = useState(false); const [hasChanges, setHasChanges] = useState(false); diff --git a/frontend/src/pages/OnboardingFlow/Steps/UserSetup/index.jsx b/frontend/src/pages/OnboardingFlow/Steps/UserSetup/index.jsx index 6c8c17c7..890b3937 100644 --- a/frontend/src/pages/OnboardingFlow/Steps/UserSetup/index.jsx +++ b/frontend/src/pages/OnboardingFlow/Steps/UserSetup/index.jsx @@ -7,6 +7,7 @@ import { useNavigate } from "react-router-dom"; import { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER } from "@/utils/constants"; import { useTranslation } from "react-i18next"; import { USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH } from "@/utils/username"; +import { PW_REGEX } from "@/pages/GeneralSettings/Security"; export default function UserSetup({ setHeader, setForwardBtn, setBackBtn }) { const { t } = useTranslation(); @@ -122,6 +123,15 @@ const JustMe = ({ e.preventDefault(); const form = e.target; const formData = new FormData(form); + + if (!PW_REGEX.test(formData.get("password"))) { + showToast( + `Your password has restricted characters in it. Allowed symbols are _,-,!,@,$,%,^,&,*,(,),;`, + "error" + ); + return; + } + const { error } = await System.updateSystemPassword({ usePassword: true, newPassword: formData.get("password"),