From b0e70dc3eb4715f68fe392d7642661d7f87b8e49 Mon Sep 17 00:00:00 2001 From: myh Date: Sun, 14 May 2023 21:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8Fbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + src/main/java/entities/dto/Login.java | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e0de811..7e60261 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Homework - - - **Last Update Time : 2023-05-07 21:06** + 日志文件:`log.md` - - - ### 运行方式: diff --git a/src/main/java/entities/dto/Login.java b/src/main/java/entities/dto/Login.java index e56a14a..18707c5 100644 --- a/src/main/java/entities/dto/Login.java +++ b/src/main/java/entities/dto/Login.java @@ -17,7 +17,7 @@ public class Login { public static boolean UserLogin(Long id) { boolean flag = false; String sql = "select password from Users where id = ?"; - + Scanner reader = new Scanner(System.in); try { conn = getConnection(); ps = conn.prepareStatement(sql); @@ -30,13 +30,9 @@ public class Login { CreateIndent();//跳转到登录选项重新输入ID } - Scanner reader = new Scanner(System.in); System.out.println("请输入登录密码:"); String password = reader.nextLine(); - while (rs.next()) { - flag = password.equals(rs.getString("password")); - } - + flag = password.equals(rs.getString("password")); } catch (Exception e) { throw new RuntimeException(e);