v1.2 登录、注册接口书写完成

pull/3/head
杨博文 4 months ago
parent 42d1b8716a
commit deb026c631

@ -16,26 +16,28 @@ public class Register {
/**
* -
* @param password1
* @param password2
* @return truefalse
*/
public static boolean isVaildPassword(String password1, String password2) {
if (password1 == null || password1.length() < 6 || password1.length() > 10) {
return false;
}
public static boolean isVaildPassword(String password1) {
// 使用正则表达式验证长度6-10只包含字母数字且包含大小写字母和数字
String regex = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{6,10}$";
if (!Pattern.matches(regex, password1)) {
return false;
}
return true;
}
System.out.print("请再次输入密码: ");
/**
* -
* @param password1
* @param password2
* @return truefalse
*/
public static boolean isEqualPassword(String password1, String password2) {
if (!password1.equals(password2)) {
System.out.println("两次输入的密码不一致!");
return false;
}
return true;
}
}

Loading…
Cancel
Save