修改BUG:登录账号邮箱格式错误无提示

This commit is contained in:
2025-11-06 10:53:34 +08:00
parent baa6f284bd
commit cc12a08472
5 changed files with 23 additions and 17 deletions

View File

@@ -67,7 +67,7 @@ fun EmailSignupScreen() {
email.isEmpty() -> context.getString(R.string.text_error_email_required)
// 邮箱格式
!android.util.Patterns.EMAIL_ADDRESS.matcher(email)
.matches() -> context.getString(R.string.text_error_email_format)
.matches() -> context.getString(R.string.text_error_email_format_1)
else -> null
}

View File

@@ -72,8 +72,17 @@ fun UserAuthScreen() {
var passwordError by remember { mutableStateOf<String?>(null) }
var captchaInfo by remember { mutableStateOf<CaptchaInfo?>(null) }
fun validateForm(): Boolean {
emailError =
if (email.isEmpty()) context.getString(R.string.text_error_email_required) else null
// 如果密码为空,先检查邮箱格式
if (password.isEmpty()) {
emailError = when {
email.isEmpty() -> context.getString(R.string.text_error_email_required)
!android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches() ->
context.getString(R.string.text_error_email_format)
else -> null
}
} else {
emailError = if (email.isEmpty()) context.getString(R.string.text_error_email_required) else null
}
// 使用通用密码校验器
val passwordValidation = PasswordValidator.validateCurrentPassword(password, context)