diff options
Diffstat (limited to 'src/view/com/modals/ChangePassword.tsx')
-rw-r--r-- | src/view/com/modals/ChangePassword.tsx | 17 |
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)) |