From 1cbcbc1f311e5bea8d82e40b39d8d6f940947863 Mon Sep 17 00:00:00 2001
From: lsbp <2803234009@qq.com>
Date: Mon, 6 Oct 2025 21:56:09 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=8F=91=E8=A1=8C=E7=89=881.01?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 34 ++++++-----
data/current_user.json | 10 ++++
dependency-reduced-pom.xml | 66 ++++++++++++++++++++++
pom.xml | 47 +++++++++------
src/main/java/com/service/UserService.java | 32 ++++++++++-
src/main/java/com/util/FileUtils.java | 26 ++++++++-
6 files changed, 181 insertions(+), 34 deletions(-)
create mode 100644 data/current_user.json
create mode 100644 dependency-reduced-pom.xml
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index d9fb858..30835f7 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,20 +9,15 @@
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
@@ -140,7 +135,8 @@
-
+
+
@@ -158,7 +154,15 @@
1759684484435
-
+
+
+ 1759749578708
+
+
+
+ 1759749578708
+
+
@@ -190,6 +194,8 @@
-
+
+
+
\ No newline at end of file
diff --git a/data/current_user.json b/data/current_user.json
new file mode 100644
index 0000000..32c4470
--- /dev/null
+++ b/data/current_user.json
@@ -0,0 +1,10 @@
+{
+ "userId": "75fd5144-97f1-44eb-bf34-d339a0cffd1c",
+ "username": "1111",
+ "password": "b6e4e03a35a862ae38516e7b6d0e0ae8c0a6444bd3d33713e7d212e8ecd5531a",
+ "email": "111@123.com",
+ "grade": "ELEMENTARY",
+ "totalQuizzes": 0,
+ "averageScore": 0.0,
+ "registrationDate": "Oct 6, 2025, 1:35:39 PM"
+}
\ No newline at end of file
diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
new file mode 100644
index 0000000..e0b5756
--- /dev/null
+++ b/dependency-reduced-pom.xml
@@ -0,0 +1,66 @@
+
+
+ 4.0.0
+ com.mathquiz
+ MathQuizApp
+ Math Quiz Application
+ 1.0.0
+ 小初高数学学习软件 - JavaFX版本
+
+
+
+ maven-compiler-plugin
+ 3.11.0
+
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+ UTF-8
+
+
+
+ maven-resources-plugin
+ 3.3.1
+
+ UTF-8
+
+
+
+ maven-shade-plugin
+ 3.5.1
+
+
+ package
+
+ shade
+
+
+
+
+ com.Test
+
+
+
+
+
+ *:*
+
+ META-INF/*.SF
+ META-INF/*.DSA
+ META-INF/*.RSA
+
+
+
+ MathQuizApp
+
+
+
+
+
+
+
+ 21
+ 21
+ UTF-8
+ 21.0.2
+
+
diff --git a/pom.xml b/pom.xml
index b719a82..ca61f37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,31 +80,44 @@
- org.openjfx
- javafx-maven-plugin
- 0.0.8
-
- com.mathquiz.MathQuizApp/com.Test
-
-
- false
- ${project.name}
- com.mathquiz
- ${project.version}
- true
- true
-
-
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.6.1
- default-cli
+ copy-dependencies
+ package
- jpackage
+ copy-dependencies
+
+ ${project.build.directory}/dependencies
+ false
+ false
+ true
+
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+
+ com.Test
+
+
+ --add-modules
+ javafx.controls,javafx.fxml,javafx.graphics,javafx.base
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/service/UserService.java b/src/main/java/com/service/UserService.java
index ed75153..efcdee2 100644
--- a/src/main/java/com/service/UserService.java
+++ b/src/main/java/com/service/UserService.java
@@ -6,6 +6,7 @@ import com.model.User;
import com.util.FileUtils;
import com.util.PasswordValidator;
+import java.io.File;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -66,6 +67,7 @@ public class UserService {
long expiryTime = System.currentTimeMillis() + CODE_EXPIRY_TIME;
// 保存到文件
+ System.out.println(expiryTime);
saveRegistrationCodeToFile(email, code, expiryTime);
// 打印注册码(实际项目中可以发邮件)
@@ -112,14 +114,40 @@ public class UserService {
FileUtils.writeStringToFile(REGISTRATION_CODES_FILE, content.toString());
}
+ /**
+ * 初始化数据目录和文件
+ */
+ private void initializeDataDirectory() {
+ try {
+ File dataDir = new File("data");
+ if (!dataDir.exists()) {
+ dataDir.mkdirs();
+ System.out.println("✓ 已创建 data 目录");
+ }
+
+ // 确保注册码文件存在(即使是空的也创建)
+ File codesFile = new File(REGISTRATION_CODES_FILE);
+ if (!codesFile.exists()) {
+ StringBuilder initialContent = new StringBuilder();
+ initialContent.append("# 注册码记录文件\n");
+ initialContent.append("# 格式: 邮箱|注册码|过期时间戳|过期时间\n\n");
+
+ FileUtils.writeStringToFile(REGISTRATION_CODES_FILE, initialContent.toString());
+ System.out.println("✓ 已创建注册码文件");
+ }
+ } catch (IOException e) {
+ System.err.println(" 初始化数据目录失败: " + e.getMessage());
+ }
+ }
+
/**
* 从文件加载注册码
*/
private Map loadRegistrationCodesFromFile() throws IOException {
Map codes = new HashMap<>();
-
+ System.out.println(REGISTRATION_CODES_FILE);
if (!FileUtils.exists(REGISTRATION_CODES_FILE)) {
- return codes;
+ FileUtils.ensureFileExists(REGISTRATION_CODES_FILE);
}
String content = FileUtils.readFileToString(REGISTRATION_CODES_FILE);
diff --git a/src/main/java/com/util/FileUtils.java b/src/main/java/com/util/FileUtils.java
index 186a2cc..ea557eb 100644
--- a/src/main/java/com/util/FileUtils.java
+++ b/src/main/java/com/util/FileUtils.java
@@ -34,9 +34,22 @@ public class FileUtils {
* @throws IOException 写入失败时抛出
*/
public static void writeStringToFile(String filePath, String content) throws IOException {
- Files.writeString(Paths.get(filePath), content, StandardCharsets.UTF_8);
+ File file = new File(filePath);
+
+ // 确保父目录存在
+ File parentDir = file.getParentFile();
+ if (parentDir != null && !parentDir.exists()) {
+ parentDir.mkdirs();
+ }
+
+ // 写入文件
+ try (BufferedWriter writer = new BufferedWriter(
+ new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) {
+ writer.write(content);
+ }
}
+
/**
* 创建目录(如果不存在)
* @param dirPath 目录路径
@@ -49,6 +62,17 @@ public class FileUtils {
}
}
+ public static void ensureFileExists(String filePath) throws IOException {
+ if (!FileUtils.exists(filePath)) {
+ // 自动创建父目录
+ String parentDir = Paths.get(filePath).getParent().toString();
+ FileUtils.createDirectoryIfNotExists(parentDir);
+
+ // 创建空文件
+ FileUtils.writeStringToFile(filePath, "");
+ }
+ }
+
/**
* 检查文件是否存在
* @param filePath 文件路径
--
2.34.1
From dc1fb185689b0a6143d149c8c98675e1af4dc120 Mon Sep 17 00:00:00 2001
From: lsbp <2803234009@qq.com>
Date: Tue, 7 Oct 2025 01:23:08 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E5=8F=91=E8=A1=8C=E7=89=881.02?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 23 ++++++--
pom.xml | 16 ++---
src/main/java/com/Test.java | 4 +-
src/main/java/com/service/FileIOService.java | 22 +++++--
src/main/java/com/service/QuizService.java | 2 +-
src/main/java/com/service/UserService.java | 58 +++++++++----------
src/main/java/com/ui/MainWindow.java | 5 +-
src/main/java/com/util/AppDataDirectory.java | 45 ++++++++++++++
src/main/java/com/util/FileUtils.java | 2 +
src/main/java/com/util/PasswordValidator.java | 27 +++------
10 files changed, 129 insertions(+), 75 deletions(-)
create mode 100644 src/main/java/com/util/AppDataDirectory.java
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 30835f7..fba0cc0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,14 +10,16 @@
-
-
-
-
+
+
+
+
+
+
@@ -28,8 +30,8 @@
@@ -137,6 +139,7 @@
+
@@ -162,7 +165,15 @@
1759749578708
-
+
+
+ 1759758970278
+
+
+
+ 1759758970278
+
+
diff --git a/pom.xml b/pom.xml
index ca61f37..2464e3f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,11 +7,11 @@
com.mathquiz
MathQuizApp
- 1.0.0
+ 1.0.2
jar
Math Quiz Application
- 小初高数学学习软件 - JavaFX版本
+ 小初高数学学习软?- JavaFX版本
@@ -100,10 +100,10 @@
-
-
-
-
+
+
+
+
org.codehaus.mojo
exec-maven-plugin
@@ -111,7 +111,7 @@
com.Test
-
+
--add-modules
javafx.controls,javafx.fxml,javafx.graphics,javafx.base
@@ -120,4 +120,4 @@
-
\ No newline at end of file
+
diff --git a/src/main/java/com/Test.java b/src/main/java/com/Test.java
index 58a542c..4b5337e 100644
--- a/src/main/java/com/Test.java
+++ b/src/main/java/com/Test.java
@@ -6,10 +6,12 @@ import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
+import java.io.IOException;
+
public class Test extends Application {
@Override
- public void start(Stage primaryStage) {
+ public void start(Stage primaryStage) throws IOException {
MainWindow mainWindow = new MainWindow(primaryStage);
Scene scene = new Scene(mainWindow, 1366, 786);
primaryStage.setTitle("中小学数学答题系统");
diff --git a/src/main/java/com/service/FileIOService.java b/src/main/java/com/service/FileIOService.java
index 3a2a56e..a04118a 100644
--- a/src/main/java/com/service/FileIOService.java
+++ b/src/main/java/com/service/FileIOService.java
@@ -2,6 +2,7 @@ package com.service;
import com.model.*;
+import com.util.AppDataDirectory;
import com.util.FileUtils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -19,12 +20,13 @@ import java.util.*;
*/
public class FileIOService {
- private static final String DATA_DIR = "data";
- private static final String USERS_DIR = DATA_DIR + "/users";
- private static final String HISTORY_DIR = DATA_DIR + "/history";
+ private static final String DATA_DIR = AppDataDirectory.getFullPath("data");
+ private static final String USERS_DIR = AppDataDirectory.getFullPath("data/users");
+ private static final String HISTORY_DIR = AppDataDirectory.getFullPath("data/history");
- private static final String USERS_FILE = DATA_DIR + "/users.json";
- private static final String CURRENT_USER_FILE = DATA_DIR + "/current_user.json";
+ private static final String REGISTRATION_CODES_FILE = AppDataDirectory.getFullPath("data/registration_codes.json");
+ private static final String USERS_FILE = AppDataDirectory.getFullPath("data/users.json");
+ private static final String CURRENT_USER_FILE = AppDataDirectory.getFullPath("data/current_user.json");
private static final Gson gson = new GsonBuilder()
.setPrettyPrinting()
@@ -33,10 +35,15 @@ public class FileIOService {
// ==================== 初始化 ====================
+ public FileIOService() throws IOException {
+ initDataDirectory();
+ }
+
public void initDataDirectory() throws IOException {
FileUtils.createDirectoryIfNotExists(DATA_DIR);
FileUtils.createDirectoryIfNotExists(USERS_DIR);
FileUtils.createDirectoryIfNotExists(HISTORY_DIR);
+ FileUtils.ensureFileExists(REGISTRATION_CODES_FILE);
if (!FileUtils.exists(USERS_FILE)) {
Map> data = new HashMap<>();
@@ -255,4 +262,9 @@ public class FileIOService {
}
return filename.replaceAll("[\\\\/:*?\"<>|]", "_");
}
+
+ public String getRegistrationCodesFilePath() {
+ return REGISTRATION_CODES_FILE;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/service/QuizService.java b/src/main/java/com/service/QuizService.java
index 2b766a5..ea153ab 100644
--- a/src/main/java/com/service/QuizService.java
+++ b/src/main/java/com/service/QuizService.java
@@ -20,7 +20,7 @@ public class QuizService {
// ==================== 构造方法 ====================
- public QuizService() {
+ public QuizService() throws IOException {
this.fileIOService = new FileIOService();
this.userService = new UserService(fileIOService);
this.currentQuestions = new ArrayList<>();
diff --git a/src/main/java/com/service/UserService.java b/src/main/java/com/service/UserService.java
index efcdee2..bc5e550 100644
--- a/src/main/java/com/service/UserService.java
+++ b/src/main/java/com/service/UserService.java
@@ -3,6 +3,7 @@ package com.service;
import com.model.Grade;
import com.model.User;
+import com.ui.NavigablePanel;
import com.util.FileUtils;
import com.util.PasswordValidator;
@@ -34,7 +35,7 @@ public class UserService {
// ==================== 构造方法 ====================
- public UserService() {
+ public UserService() throws IOException {
this.fileIOService = new FileIOService();
this.currentUser = null;
}
@@ -44,8 +45,6 @@ public class UserService {
this.currentUser = null;
}
- // 注册码文件路径
- private static final String REGISTRATION_CODES_FILE = "data/registration_codes.txt";
// 注册码有效期(毫秒)
private static final long CODE_EXPIRY_TIME = 10 * 60 * 1000; // 10分钟
@@ -111,7 +110,7 @@ public class UserService {
.append("\n");
}
- FileUtils.writeStringToFile(REGISTRATION_CODES_FILE, content.toString());
+ FileUtils.writeStringToFile(fileIOService.getRegistrationCodesFilePath(), content.toString());
}
/**
@@ -126,13 +125,13 @@ public class UserService {
}
// 确保注册码文件存在(即使是空的也创建)
- File codesFile = new File(REGISTRATION_CODES_FILE);
+ File codesFile = new File(fileIOService.getRegistrationCodesFilePath());
if (!codesFile.exists()) {
StringBuilder initialContent = new StringBuilder();
initialContent.append("# 注册码记录文件\n");
initialContent.append("# 格式: 邮箱|注册码|过期时间戳|过期时间\n\n");
- FileUtils.writeStringToFile(REGISTRATION_CODES_FILE, initialContent.toString());
+ FileUtils.writeStringToFile(fileIOService.getRegistrationCodesFilePath(), initialContent.toString());
System.out.println("✓ 已创建注册码文件");
}
} catch (IOException e) {
@@ -145,12 +144,12 @@ public class UserService {
*/
private Map loadRegistrationCodesFromFile() throws IOException {
Map codes = new HashMap<>();
- System.out.println(REGISTRATION_CODES_FILE);
- if (!FileUtils.exists(REGISTRATION_CODES_FILE)) {
- FileUtils.ensureFileExists(REGISTRATION_CODES_FILE);
+ System.out.println(fileIOService.getRegistrationCodesFilePath());
+ if (!FileUtils.exists(fileIOService.getRegistrationCodesFilePath())) {
+ throw new IOException("目录不存在");
}
- String content = FileUtils.readFileToString(REGISTRATION_CODES_FILE);
+ String content = FileUtils.readFileToString(fileIOService.getRegistrationCodesFilePath());
String[] lines = content.split("\n");
for (String line : lines) {
@@ -227,7 +226,7 @@ public class UserService {
.append("\n");
}
- FileUtils.writeStringToFile(REGISTRATION_CODES_FILE, content.toString());
+ FileUtils.writeStringToFile(fileIOService.getRegistrationCodesFilePath(), content.toString());
}
/**
@@ -270,10 +269,9 @@ public class UserService {
throw new IllegalArgumentException("注册码错误!");
}
-// // 2. 验证用户名格式
-// if (!validateUsername(username)) {
-// throw new IllegalArgumentException("用户名格式错误!正确格式:学段-姓名(如:小学-张三)");
-// }
+ if (!validateEmail(email)) {
+ throw new IllegalArgumentException("邮箱格式错误!");
+ }
// 3. 验证用户名是否已存在
if (fileIOService.isEmailExists(email)) {
@@ -286,9 +284,11 @@ public class UserService {
// throw new IllegalArgumentException(passwordError);
// }
- // 5. 验证邮箱格式
- if (!validateEmail(email)) {
- throw new IllegalArgumentException("邮箱格式错误!");
+ // 5. 验证密码格式
+ try {
+ PasswordValidator.validatePassword(password);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("密码格式错误!");
}
// 6. 从用户名中提取学段
@@ -370,17 +370,10 @@ public class UserService {
throw new IllegalArgumentException("旧密码错误!");
}
- String passwordError = PasswordValidator.validatePassword(newPassword);
- if (passwordError != null) {
- throw new IllegalArgumentException(passwordError);
- }
-
- if (oldPassword.equals(newPassword)) {
- throw new IllegalArgumentException("新密码不能与旧密码相同!");
- }
-
- if (!oldPassword.equals(confirmPassword)) {
- throw new IllegalArgumentException("两次新密码不同!");
+ try {
+ PasswordValidator.validatePassword(newPassword);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException(e.getMessage());
}
String hashedNewPassword = PasswordValidator.encrypt(newPassword);
@@ -408,9 +401,10 @@ public class UserService {
throw new IllegalArgumentException("邮箱验证失败!");
}
- String passwordError = PasswordValidator.validatePassword(newPassword);
- if (passwordError != null) {
- throw new IllegalArgumentException(passwordError);
+ try {
+ PasswordValidator.validatePassword(newPassword);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException(e.getMessage());
}
String hashedNewPassword = PasswordValidator.encrypt(newPassword);
diff --git a/src/main/java/com/ui/MainWindow.java b/src/main/java/com/ui/MainWindow.java
index 73d4e5d..3c1d226 100644
--- a/src/main/java/com/ui/MainWindow.java
+++ b/src/main/java/com/ui/MainWindow.java
@@ -12,7 +12,6 @@ import javafx.scene.control.Toggle;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.io.IOException;
-import java.util.List;
public class MainWindow extends BorderPane {
private final UserService userService = new UserService();
@@ -22,7 +21,7 @@ public class MainWindow extends BorderPane {
private final Stage primaryStage;
private Panel currentPanel;
- public MainWindow(Stage primaryStage) {
+ public MainWindow(Stage primaryStage) throws IOException {
this.primaryStage = primaryStage;
showStartPage();
}
@@ -276,7 +275,7 @@ public class MainWindow extends BorderPane {
return currentPanel;
}
- public static void start(Stage stage) {
+ public static void start(Stage stage) throws IOException {
MainWindow mainWindow = new MainWindow(stage);
Scene scene = new Scene(mainWindow, 800, 600);
stage.setScene(scene);
diff --git a/src/main/java/com/util/AppDataDirectory.java b/src/main/java/com/util/AppDataDirectory.java
new file mode 100644
index 0000000..38377cc
--- /dev/null
+++ b/src/main/java/com/util/AppDataDirectory.java
@@ -0,0 +1,45 @@
+package com.util;
+
+import java.io.File;
+
+/**
+ * 应用数据目录管理器
+ * 根据不同操作系统返回合适的应用数据存储路径
+ */
+public class AppDataDirectory {
+ private static final String APP_NAME = "Math-Quiz-App"; // 替换为你的应用名
+
+ /**
+ * 获取应用数据根目录
+ */
+ public static String getApplicationDataDirectory() {
+ String os = System.getProperty("os.name").toLowerCase();
+ String basePath;
+
+ if (os.contains("win")) {
+ // Windows
+ String appData = System.getenv("APPDATA");
+ basePath = (appData != null) ? appData : System.getProperty("user.home") + "/AppData/Roaming";
+ } else if (os.contains("mac")) {
+ // macOS
+ basePath = System.getProperty("user.home") + "/Library/Application Support";
+ } else {
+ // Linux/Unix
+ String xdgDataHome = System.getenv("XDG_DATA_HOME");
+ if (xdgDataHome == null) {
+ xdgDataHome = System.getProperty("user.home") + "/.local/share";
+ }
+ basePath = xdgDataHome;
+ }
+
+ return basePath + "/" + APP_NAME;
+ }
+
+ /**
+ * 获取完整的应用数据路径
+ */
+ public static String getFullPath(String relativePath) {
+ String appDataDir = getApplicationDataDirectory();
+ return appDataDir + "/" + relativePath;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/util/FileUtils.java b/src/main/java/com/util/FileUtils.java
index ea557eb..0a46661 100644
--- a/src/main/java/com/util/FileUtils.java
+++ b/src/main/java/com/util/FileUtils.java
@@ -58,7 +58,9 @@ public class FileUtils {
public static void createDirectoryIfNotExists(String dirPath) throws IOException {
Path path = Paths.get(dirPath);
if (!Files.exists(path)) {
+ System.out.println(1);
Files.createDirectories(path);
+ System.out.println(2);
}
}
diff --git a/src/main/java/com/util/PasswordValidator.java b/src/main/java/com/util/PasswordValidator.java
index 7c167df..f5a8be3 100644
--- a/src/main/java/com/util/PasswordValidator.java
+++ b/src/main/java/com/util/PasswordValidator.java
@@ -29,53 +29,42 @@ public class PasswordValidator {
* @param password 待验证的密码
* @return 如果密码有效返回 null,否则返回错误信息
*/
- public static String validatePassword(String password) {
+ public static void validatePassword(String password) {
if (password == null || password.isEmpty()) {
- return "密码不能为空!";
+ throw new IllegalArgumentException("密码不能为空!");
}
if (password.length() < MIN_LENGTH) {
- return "密码长度不能少于 " + MIN_LENGTH + " 位!";
+ throw new IllegalArgumentException("密码长度不能少于 " + MIN_LENGTH + " 位!");
}
if (password.length() > MAX_LENGTH) {
- return "密码长度不能超过 " + MAX_LENGTH + " 位!";
+ throw new IllegalArgumentException ("密码长度不能超过 " + MAX_LENGTH + " 位!");
}
if (password.contains(" ")) {
- return "密码不能包含空格!";
+ throw new IllegalArgumentException ("密码不能包含空格!");
}
// 检查是否包含小写字母
boolean hasLowerLetter = password.matches(".*[a-z].*");
if (!hasLowerLetter) {
- return "必须包含小写字母!";
+ throw new IllegalArgumentException ("必须包含小写字母!");
}
// 检查是否包含大写字母
boolean hasUpperLetter = password.matches(".*[A-Z].*");
if (!hasUpperLetter) {
- return "必须包含大写字母!";
+ throw new IllegalArgumentException ("必须包含大写字母!");
}
// 检查是否包含数字
boolean hasDigit = password.matches(".*\\d.*");
if (!hasDigit) {
- return "密码必须包含数字!";
+ throw new IllegalArgumentException ("密码必须包含数字!");
}
-
- return null; // 验证通过
}
- /**
- * 验证密码格式(简单版本)
- *
- * @param password 待验证的密码
- * @return true表示格式正确
- */
- public static boolean isValid(String password) {
- return validatePassword(password) == null;
- }
// /**
// * 检查密码强度等级
--
2.34.1