小bug修改

This commit is contained in:
myh 2023-05-14 21:48:59 +08:00
parent ab306eff80
commit 47de8a8c65
2 changed files with 3 additions and 6 deletions

View File

@ -1,6 +1,7 @@
# Homework # Homework
- - - - - -
**Last Update Time : 2023-05-07 21:06** **Last Update Time : 2023-05-07 21:06**
日志文件:`log.md` 日志文件:`log.md`
- - - - - -
### 运行方式: ### 运行方式:

View File

@ -17,7 +17,7 @@ public class Login {
public static boolean UserLogin(Long id) { public static boolean UserLogin(Long id) {
boolean flag = false; boolean flag = false;
String sql = "select password from Users where id = ?"; String sql = "select password from Users where id = ?";
Scanner reader = new Scanner(System.in);
try { try {
conn = getConnection(); conn = getConnection();
ps = conn.prepareStatement(sql); ps = conn.prepareStatement(sql);
@ -30,13 +30,9 @@ public class Login {
CreateIndent();//跳转到登录选项重新输入ID CreateIndent();//跳转到登录选项重新输入ID
} }
Scanner reader = new Scanner(System.in);
System.out.println("请输入登录密码:"); System.out.println("请输入登录密码:");
String password = reader.nextLine(); String password = reader.nextLine();
while (rs.next()) {
flag = password.equals(rs.getString("password")); flag = password.equals(rs.getString("password"));
}
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);