about summary refs log tree commit diff
path: root/src/view/com/modals/ChangePassword.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-02-24 12:44:21 -0800
committerGitHub <noreply@github.com>2025-02-24 12:44:21 -0800
commitae9176c9c2112641c6484ac4b50edfbd94d29661 (patch)
tree14bafaa11ed4a2dfb5a7b2ed722bcf2991896361 /src/view/com/modals/ChangePassword.tsx
parent3d954a00e009f85433e4b5f43d0d1960c8f6c639 (diff)
downloadvoidsky-ae9176c9c2112641c6484ac4b50edfbd94d29661.tar.zst
Basic minimum password requirements, plus field-specific errors (#7811)
* add min password requirement

* add field specific errors

* move email tld check to after other email checks

* add password length check to change password dialog

* Update src/view/com/modals/ChangePassword.tsx

Co-authored-by: Hailey <me@haileyok.com>

* Update src/screens/Signup/StepInfo/index.tsx

Co-authored-by: Hailey <me@haileyok.com>

* fix lint

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/view/com/modals/ChangePassword.tsx')
-rw-r--r--src/view/com/modals/ChangePassword.tsx17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/view/com/modals/ChangePassword.tsx b/src/view/com/modals/ChangePassword.tsx
index d68b4e453..9b96e7db0 100644
--- a/src/view/com/modals/ChangePassword.tsx
+++ b/src/view/com/modals/ChangePassword.tsx
@@ -81,8 +81,7 @@ export function Component() {
 
   const onChangePassword = async () => {
     const formattedCode = checkAndFormatResetCode(resetCode)
-    // TODO Better password strength check
-    if (!formattedCode || !newPassword) {
+    if (!formattedCode) {
       setError(
         _(
           msg`You have entered an invalid code. It should look like XXXXX-XXXXX.`,
@@ -90,6 +89,16 @@ export function Component() {
       )
       return
     }
+    if (!newPassword) {
+      setError(
+        _(msg`Please enter a password. It must be at least 8 characters long.`),
+      )
+      return
+    }
+    if (newPassword.length < 8) {
+      setError(_(msg`Password must be at least 8 characters long.`))
+      return
+    }
 
     setError('')
     setIsProcessing(true)
@@ -104,7 +113,9 @@ export function Component() {
       logger.warn('Failed to set new password', {error: e})
       if (isNetworkError(e)) {
         setError(
-          'Unable to contact your service. Please check your Internet connection.',
+          _(
+            msg`Unable to contact your service. Please check your Internet connection.`,
+          ),
         )
       } else {
         setError(cleanError(errMsg))