Package com.ehealthsystem.login
Class LoginController
java.lang.Object
com.ehealthsystem.login.LoginController
-
Field Summary
Modifier and TypeFieldDescriptionjavafx.scene.control.TextField
javafx.scene.control.Label
javafx.scene.control.Button
javafx.scene.control.PasswordField
javafx.scene.control.Label
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
handleLoginButton
(javafx.event.ActionEvent event) Method called when Login Button is pressed.void
handleRegistrationLabel
(javafx.scene.input.MouseEvent event) Method called to switch scene to registration form.private void
loadAdminWindow
(javafx.event.ActionEvent event) private void
loadPrimaryWindow
(javafx.event.Event event) Method called to switch scene to primary window after successfully logged in.private boolean
Check if the user that is currently logging in is the system's administratorboolean
Method to validate the email and password matches with the email and password in the databaseprivate boolean
Method to validate the Password typed in.private boolean
Method to validate the email format.
-
Field Details
-
emailTextField
public javafx.scene.control.TextField emailTextField -
passwordField
public javafx.scene.control.PasswordField passwordField -
loginButton
public javafx.scene.control.Button loginButton -
registrationLabel
public javafx.scene.control.Label registrationLabel -
errorLabel
public javafx.scene.control.Label errorLabel
-
-
Constructor Details
-
LoginController
public LoginController()
-
-
Method Details
-
handleLoginButton
Method called when Login Button is pressed. Used to validate the filled in information.- Parameters:
event
- event that triggered the login button- Throws:
IOException
SQLException
-
validateAdmin
private boolean validateAdmin()Check if the user that is currently logging in is the system's administrator- Returns:
- whether the admin is logging in
-
validateUsernameOrEmail
private boolean validateUsernameOrEmail()Method to validate the email format.- Returns:
- true if email format filled in matches pattern
-
validatePasswordField
private boolean validatePasswordField()Method to validate the Password typed in.- Returns:
- true if the password field is filled
-
loadPrimaryWindow
Method called to switch scene to primary window after successfully logged in.- Throws:
IOException
- FXMLLoader can't find file for switching sceneSQLException
-
loadAdminWindow
- Throws:
SQLException
IOException
-
validateCredentials
Method to validate the email and password matches with the email and password in the database- Returns:
- true if credentials match the credentials in the database
- Throws:
SQLException
-
handleRegistrationLabel
Method called to switch scene to registration form.- Parameters:
event
- MouseEvent that triggered the method- Throws:
IOException
- if the FXMLLoader can't find the scene
-