fix: harden struts auth responses
This commit is contained in:
@@ -34,15 +34,15 @@ public class UserAction extends ActionSupport {
|
||||
private boolean isValid() {
|
||||
boolean valid = true;
|
||||
if (username == null || username.length() < 3) {
|
||||
addFieldError("username", "用户名至少 3 个字符。 / Username must be at least 3 characters.");
|
||||
addFieldError("username", "用户名至少 3 个字符。/ Username must be at least 3 characters.");
|
||||
valid = false;
|
||||
}
|
||||
if (email == null || !email.contains("@")) {
|
||||
addFieldError("email", "请输入有效邮箱。 / Enter a valid email address.");
|
||||
addFieldError("email", "请输入有效邮箱。/ Enter a valid email address.");
|
||||
valid = false;
|
||||
}
|
||||
if (phone == null || phone.replaceAll("[^0-9]", "").length() < 7) {
|
||||
addFieldError("phone", "手机号至少 7 位数字。 / Enter at least 7 digits for the phone number.");
|
||||
addFieldError("phone", "手机号至少 7 位数字。/ Enter at least 7 digits for the phone number.");
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
|
||||
Reference in New Issue
Block a user