From 7971e2bb663049ec45b6421383e2c0035cd7584b Mon Sep 17 00:00:00 2001
From: YangShuaiLu <3417398995@qq.com>
Date: Sun, 12 Oct 2025 14:12:46 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E4=BF=9D=E7=95=99=20src=20=E5=92=8C?=
=?UTF-8?q?=20doc=20=E7=9B=AE=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 29 -------------------
.idea/.gitignore | 5 ----
.idea/.name | 1 -
.idea/artifacts/untitled111_jar.xml | 21 --------------
.idea/misc.xml | 6 ----
.idea/modules.xml | 8 -----
.idea/vcs.xml | 6 ----
README.md | 2 --
src/Main.java | 45 +++++++++++++++++++++++++++--
untitled111.iml | 30 -------------------
10 files changed, 43 insertions(+), 110 deletions(-)
delete mode 100644 .gitignore
delete mode 100644 .idea/.gitignore
delete mode 100644 .idea/.name
delete mode 100644 .idea/artifacts/untitled111_jar.xml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/vcs.xml
delete mode 100644 README.md
delete mode 100644 untitled111.iml
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index f68d109..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,29 +0,0 @@
-### IntelliJ IDEA ###
-out/
-!**/src/main/**/out/
-!**/src/test/**/out/
-
-### Eclipse ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-bin/
-!**/src/main/**/bin/
-!**/src/test/**/bin/
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-
-### VS Code ###
-.vscode/
-
-### Mac OS ###
-.DS_Store
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 10b731c..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-# 默认忽略的文件
-/shelf/
-/workspace.xml
-# 基于编辑器的 HTTP 客户端请求
-/httpRequests/
diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index 2b3e571..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-untitled111.iml
\ No newline at end of file
diff --git a/.idea/artifacts/untitled111_jar.xml b/.idea/artifacts/untitled111_jar.xml
deleted file mode 100644
index 5ef401c..0000000
--- a/.idea/artifacts/untitled111_jar.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- $PROJECT_DIR$/out/artifacts/untitled111_jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 2bfdeda..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 5116208..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 3d42da1..0000000
--- a/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# pairing_program
-
diff --git a/src/Main.java b/src/Main.java
index 6aa0089..484e558 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -141,13 +141,13 @@ public class Main extends Application {
infoLabel.setText("用户名已存在");
return;
}
-/*
+
// 使用新的邮箱验证方法
if (!isValidEmail(email)) {
infoLabel.setText("邮箱格式不正确,请使用有效的邮箱地址");
return;
}
-*/
+
if (userDatabase.containsKey(email)) {
infoLabel.setText("该邮箱已注册");
return;
@@ -224,6 +224,47 @@ public class Main extends Application {
return username.matches("^[a-zA-Z0-9_]+$");
}
+ // 邮箱验证方法
+ private boolean isValidEmail(String email) {
+ if (email == null || email.trim().isEmpty()) {
+ return false;
+ }
+
+ String regex = "^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$";
+
+ // 基本格式检查
+ if (!email.matches(regex)) {
+ return false;
+ }
+
+ // 检查@符号位置
+ int atIndex = email.indexOf('@');
+ if (atIndex <= 0 || atIndex == email.length() - 1) {
+ return false;
+ }
+
+ // 检查域名部分
+ String domain = email.substring(atIndex + 1);
+ if (domain.indexOf('.') <= 0 || domain.endsWith(".")) {
+ return false;
+ }
+
+ // 检查常见邮箱服务商
+ String[] commonDomains = {"qq.com", "gmail.com", "163.com", "126.com", "sina.com",
+ "hotmail.com", "outlook.com", "yahoo.com", "foxmail.com"};
+ boolean hasCommonDomain = false;
+ for (String commonDomain : commonDomains) {
+ if (domain.equalsIgnoreCase(commonDomain)) {
+ hasCommonDomain = true;
+ break;
+ }
+ }
+
+
+
+ return true;
+ }
+
// 密码验证方法
private boolean isValidPassword(String password) {
if (password.length() < 6 || password.length() > 10) {
diff --git a/untitled111.iml b/untitled111.iml
deleted file mode 100644
index a3ee431..0000000
--- a/untitled111.iml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file