feat(auth): enhance password policy with stronger requirements
Some checks failed
Frontend CI / build-android-apk (push) Failing after 8m40s
Frontend CI / ota-android (push) Successful in 12m13s
Frontend CI / build-and-push-web (push) Successful in 2m47s

Update password validation across authentication screens to require minimum 8 characters with uppercase letters, lowercase letters, and numbers. Changes applied to ForgotPasswordScreen, RegisterStep3Profile, and AccountSecurityScreen. LoginScreen password validation was removed as it occurs post-authentication.
This commit is contained in:
lafay
2026-04-07 00:12:03 +08:00
parent 542d385d08
commit accf7c04e8
4 changed files with 38 additions and 12 deletions

View File

@@ -149,8 +149,20 @@ export const AccountSecurityScreen: React.FC = () => {
showPrompt({ title: '提示', message: '请输入邮箱验证码', type: 'warning' });
return;
}
if (newPassword.length < 6) {
showPrompt({ title: '提示', message: '新密码至少 6 位', type: 'warning' });
if (newPassword.length < 8) {
showPrompt({ title: '提示', message: '新密码至少 8 位', type: 'warning' });
return;
}
if (!/[A-Z]/.test(newPassword)) {
showPrompt({ title: '提示', message: '新密码必须包含大写字母', type: 'warning' });
return;
}
if (!/[a-z]/.test(newPassword)) {
showPrompt({ title: '提示', message: '新密码必须包含小写字母', type: 'warning' });
return;
}
if (!/[0-9]/.test(newPassword)) {
showPrompt({ title: '提示', message: '新密码必须包含数字', type: 'warning' });
return;
}
if (newPassword !== confirmPassword) {
@@ -297,7 +309,7 @@ export const AccountSecurityScreen: React.FC = () => {
<MaterialCommunityIcons name="lock-plus-outline" size={20} color={colors.text.secondary} style={styles.inputIcon} />
<TextInput
style={styles.input}
placeholder="新密码(至少6位"
placeholder="新密码(至少8位含大小写字母和数字"
placeholderTextColor={colors.text.hint}
value={newPassword}
onChangeText={setNewPassword}