Package com.ehealthsystem.login
Class LoginController
java.lang.Object
com.ehealthsystem.login.LoginController
-
Field Summary
FieldsModifier and TypeFieldDescriptionjavafx.scene.control.TextFieldjavafx.scene.control.Labeljavafx.scene.control.Buttonjavafx.scene.control.PasswordFieldjavafx.scene.control.Label -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleLoginButton(javafx.event.ActionEvent event) Method called when Login Button is pressed.voidhandleRegistrationLabel(javafx.scene.input.MouseEvent event) Method called to switch scene to registration form.private voidloadAdminWindow(javafx.event.ActionEvent event) private voidloadPrimaryWindow(javafx.event.Event event) Method called to switch scene to primary window after successfully logged in.private booleanCheck if the user that is currently logging in is the system's administratorbooleanMethod to validate the email and password matches with the email and password in the databaseprivate booleanMethod to validate the Password typed in.private booleanMethod 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:
IOExceptionSQLException
-
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:
SQLExceptionIOException
-
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
-