ensemble
Class LoginBean

java.lang.Object
  extended by ensemble.LoginBean
All Implemented Interfaces:
java.io.Serializable

@Named
@RequestScoped
public class LoginBean
extends java.lang.Object
implements java.io.Serializable

This bean deals with information from an individual login/registration request.

See Also:
Serialized Form

Constructor Summary
LoginBean()
          Sets data members to default values.
 
Method Summary
 java.lang.String getConfirm()
          The password confirmation to be considered in registration.
 java.lang.String getPassword()
          The password being considered.
 java.lang.String getUsername()
          The username being considered.
 boolean isBadName()
          Flag indicating that the current username is unsuitable.
 boolean isBadPassword()
          Flag indicating that password and confirmation fields do not match.
 java.lang.String login()
          Takes the name and password entered by the user and runs them through the database.
 java.lang.String register()
          Takes a name and password given by the user and attempts to register them in the database.
 java.lang.String registerAdmin()
          Registers the password for the admin account, then directs to the upload page.
 void setConfirm(java.lang.String confirm)
          Sets the password confirmation to be considered in registration.
 void setPassword(java.lang.String password)
          Sets the password being considered.
 void setUsername(java.lang.String username)
          Sets the username being considered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoginBean

public LoginBean()
Sets data members to default values.

Method Detail

login

public java.lang.String login()
Takes the name and password entered by the user and runs them through the database. Navigation and error flags are set based on the outcome.

Returns:
"/upload/upload" if login was successful, "/index" otherwise, or "dbError" in the event of a database error

register

public java.lang.String register()
Takes a name and password given by the user and attempts to register them in the database. Navigation and error flags are set based on the outcome.

Returns:
"/upload/upload" if registration was successful, "register" if not, or "dbError" in the event of a database error

registerAdmin

public java.lang.String registerAdmin()
Registers the password for the admin account, then directs to the upload page.

Returns:
"/upload/upload", or "index" in the event of a mismatched password, or "dbError" if there is a database error

setPassword

public void setPassword(java.lang.String password)
Sets the password being considered.

Parameters:
password - The desired password

setUsername

public void setUsername(java.lang.String username)
Sets the username being considered.

Parameters:
username - The desired username

getPassword

public java.lang.String getPassword()
The password being considered.

Returns:
The current password

setConfirm

public void setConfirm(java.lang.String confirm)
Sets the password confirmation to be considered in registration.

Parameters:
confirm - The password confirmation

getConfirm

public java.lang.String getConfirm()
The password confirmation to be considered in registration.

Returns:
The password confirmation

getUsername

public java.lang.String getUsername()
The username being considered.

Returns:
The current username

isBadName

public boolean isBadName()
Flag indicating that the current username is unsuitable.

Returns:
True if the current username cannot be used, else false

isBadPassword

public boolean isBadPassword()
Flag indicating that password and confirmation fields do not match.

Returns:
True if password and confirm fields are mismatched, else false