Class LoginController

java.lang.Object
controller.LoginController

public class LoginController extends Object
Handles login logic
  • Constructor Details

    • LoginController

      public LoginController(UserDetails user, JDialogLogin dlg)
      Constructs a new object
      Parameters:
      user - This UserDetails object will be populated with logged in user's details when log in is successful
      dlg - The dialogue (view) this controller works with
  • Method Details

    • login

      public void login()
      Logs user in. There are four possible outcomes 1. User exists and succesfully logs in 2. User is new so is added to the database and successfully logs in 3. The login is cancelled. 4. A critical database error occurs This method makes use of methods verifyLogin for existing users and createNewUser for new users
    • isDatabaseError

      public boolean isDatabaseError()
      Client may be interested to know whether an SQL error occurred creating a new user
      Returns:
      true if SQL error did occur otherwise false
    • isSuccessfulLogin

      public boolean isSuccessfulLogin()
      Returns:
      true if login was successful
    • isLoginCancelled

      public boolean isLoginCancelled()
      Returns:
      if the login was cancelled
    • getUser

      public UserDetails getUser()