From bc7f5397eafa3d8c95065f04ae6a44969d5eb4af Mon Sep 17 00:00:00 2001 From: 50582 <505822174@qq.com> Date: Thu, 26 Dec 2019 17:26:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E7=B1=BB?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BE=E7=89=87=E5=BA=8F=E5=88=97Arraylist?= =?UTF-8?q?=EF=BC=8C=E6=AF=8F=E6=AC=A1=E7=99=BB=E9=99=86=E6=97=B6=E9=83=BD?= =?UTF-8?q?=E4=BC=9A=E8=BD=BD=E5=85=A5=E7=94=A8=E6=88=B7=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E5=BA=8F=E5=88=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/imgzip/LoginSignIn/ChangePassword.java | 4 +-- .../LoginSignIn/CreateAccountController.java | 2 +- .../LoginSignIn/FindPasswordController.java | 4 +++ src/imgzip/LoginSignIn/LoginController.java | 32 ++++++++++++------- src/imgzip/mainpane/Change_email.java | 2 ++ txtFile/RememberAccount&Password.txt | 2 +- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/imgzip/LoginSignIn/ChangePassword.java b/src/imgzip/LoginSignIn/ChangePassword.java index 4f9e2e0..89ad12f 100644 --- a/src/imgzip/LoginSignIn/ChangePassword.java +++ b/src/imgzip/LoginSignIn/ChangePassword.java @@ -79,7 +79,7 @@ public class ChangePassword { if(judgeIsLogined == 0){ new LoginBeginner(); }else if(judgeIsLogined == 1){ - new Pane_sceenbeginner(); + new Personal(); } }); @@ -141,7 +141,7 @@ class ChangePasswordSuccessfully{ }); }else { primaryStage.setOnCloseRequest(e->{ - new Pane_sceenbeginner(); + new Personal(); }); } diff --git a/src/imgzip/LoginSignIn/CreateAccountController.java b/src/imgzip/LoginSignIn/CreateAccountController.java index 5554d3b..033d4e3 100644 --- a/src/imgzip/LoginSignIn/CreateAccountController.java +++ b/src/imgzip/LoginSignIn/CreateAccountController.java @@ -189,7 +189,7 @@ public class CreateAccountController { createAccountInstruction.queryUpdate(currentInstruction); /** - 检查数据库中是否成功插入数据 + 检查数据库中是否成功插入数据,如果没有插入数据,则会跳出提醒框提醒用户 */ String currentInstruction2 = "SELECT pwd FROM login WHERE userName=" + "'" + userName.getText().trim() + "'"; rs = createAccountInstruction.queryExcecute(currentInstruction2); diff --git a/src/imgzip/LoginSignIn/FindPasswordController.java b/src/imgzip/LoginSignIn/FindPasswordController.java index d6c7bcc..cfdc2e8 100644 --- a/src/imgzip/LoginSignIn/FindPasswordController.java +++ b/src/imgzip/LoginSignIn/FindPasswordController.java @@ -86,6 +86,10 @@ public class FindPasswordController { Stage stage = (Stage)account.getScene().getWindow(); stage.close(); + + /** + * 当用户认证失败时,告诉用户是账户名错误还是邮箱错误。 + */ }else { AlertWindow alertWindow = new AlertWindow("验证失败","YOUR EMAIL IS WRONG"); // 此处写警告弹窗的标题和内容 // 用于新加按钮,可以新加多个,最后添加在VBox中 diff --git a/src/imgzip/LoginSignIn/LoginController.java b/src/imgzip/LoginSignIn/LoginController.java index 5bd721b..3dec2ec 100644 --- a/src/imgzip/LoginSignIn/LoginController.java +++ b/src/imgzip/LoginSignIn/LoginController.java @@ -11,6 +11,7 @@ import java.io.FileWriter; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; /** @@ -114,6 +115,16 @@ public class LoginController { GlobalStringManager.setAccount(account.getText()); loadPicturesSequences(); + /** + * 测试是否载入成功 + */ +// ArrayList now = new ArrayList<>(); +// now = GlobalStringManager.getPicSequences(); +// for (int i = 0 ; i < now.size() ; i++){ +// System.out.println(now.get(i)); +// } + + Stage stage = (Stage)account.getScene().getWindow(); new Personal(); stage.close(); @@ -195,10 +206,13 @@ public class LoginController { } - + /** + * 加载用户的图片序列。 + * 图片序列是指:用户在上传图像的时候会得到一个随机的,一一对应的图片序列码,用于从服务器中提取对应的图片。 + * 当用户登录时,程序会访问数据库中储存的所有序列码,并加载到全局变量类中供其他页面获取。 + */ public void loadPicturesSequences(){ - DataBaseController loadingInstruction = new DataBaseController(); ResultSet rs = null; try{ @@ -207,13 +221,14 @@ public class LoginController { rs = loadingInstruction.queryExcecute(currentInstruction); if(rs.next()){ - + rs.last(); int columnCount = rs.getRow(); + rs.first(); for(int i = 1 ; i <= columnCount ; i++){ - GlobalStringManager.setPicSequences(rs.getString(i)); + GlobalStringManager.setPicSequences(rs.getString(1)); + System.out.println(rs.getString(1)); + rs.next(); } - - } }catch (SQLException e){ @@ -223,11 +238,6 @@ public class LoginController { loadingInstruction.close(); } - - - } - - } diff --git a/src/imgzip/mainpane/Change_email.java b/src/imgzip/mainpane/Change_email.java index 10a4e5c..3fd0467 100644 --- a/src/imgzip/mainpane/Change_email.java +++ b/src/imgzip/mainpane/Change_email.java @@ -21,6 +21,8 @@ public class Change_email { primaryStage.setScene(new Scene(root, 400, 300)); primaryStage.show(); + + }catch (Exception e){ e.printStackTrace(); } diff --git a/txtFile/RememberAccount&Password.txt b/txtFile/RememberAccount&Password.txt index da6f3a9..d4fad7a 100644 --- a/txtFile/RememberAccount&Password.txt +++ b/txtFile/RememberAccount&Password.txt @@ -1 +1 @@ -asdfgh|asdfgh|true +wxlll|1234|true -- Gitee