Thank you for your attention.
I created a program in which I use the "Login Form" and "Registration" form. Once users register their email address, their password will be saved to submit.txt. Then they will return to the login form and enter your email address and password, which are stored in submit.txt.
In my code, I use a write file for the Register form and a Read file for the login form. But that will not work. I know my problem in the code used for Read File. Can you help me figure this out?
Thank you so much for your help.
if (checkPassword(usern, hash)) {
System.out.println("Logged in!");
ChooseWindow ptb = new ChooseWindow();
ptb.setVisible(true);
LoginWindow.this.dispose();
} else {
System.out.println("Wrong password");
}
public boolean checkPassword(String username, String pass) {
try {
FileReader inFile = new FileReader("/users/Ender/Desktop/GetUser/submit.txt");
BufferedReader inStream = new BufferedReader(inFile);
String inString;
while ((inString = inStream.readLine()) != null) {}
inStream.close();
}catch (IOException e) {
e.printStackTrace();
}
return false;
}
source
share