|
|
@ -46,6 +46,15 @@ public class LoginGUI extends JFrame implements ActionListener { |
|
|
|
|
|
|
|
passwordField.addKeyListener(new EnterKeyListener()); |
|
|
|
|
|
|
|
stayLoggedInCheckbox.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
boolean stayLoggedIn = stayLoggedInCheckbox.isSelected(); |
|
|
|
String username = usernameField.getText(); |
|
|
|
updateStayLoggedIn(username, stayLoggedIn); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -71,8 +80,8 @@ public class LoginGUI extends JFrame implements ActionListener { |
|
|
|
} |
|
|
|
|
|
|
|
private void updateStayLoggedIn(String username, boolean stayLoggedIn) { |
|
|
|
// Update stayLoggedIn in the JSON file for the user |
|
|
|
|
|
|
|
// Update stayLoggedIn in the JSON file for the user |
|
|
|
CreateUser.updateStayLoggedIn("user.json", username, stayLoggedIn); |
|
|
|
} |
|
|
|
|
|
|
|
// Function to authenticate the user by comparing the entered username and password with the saved user data |
|
|
|