/** * Method to render the login HTML form. * * @return string * * @since 1.0 */ public function displayLoginForm() { $config = ConfigProvider::getInstance(); $html = '<div class="bordered padded">'; $html .= '<h1>Login</h1>'; $html .= '<form action="' . FrontController::generateSecureURL('act=Alpha\\Controller\\LoginController') . '" method="POST" id="loginForm" accept-charset="UTF-8">'; $request = new Request(array('method' => 'GET')); $email = new String($request->getParam('email', '')); $email->setRule(Validator::REQUIRED_EMAIL); $email->setSize(70); $email->setHelper('Please provide a valid e-mail address!'); $stringBox = new StringBox($email, $this->BO->getDataLabel('email'), 'email', 'loginForm', '50'); $html .= $stringBox->render(); $password = new String(); $password->isPassword(); $stringBox = new StringBox($password, $this->BO->getDataLabel('password'), 'password', 'loginForm', '50'); $html .= $stringBox->render(); $temp = new Button('submit', 'Login', 'loginBut'); $html .= '<div class="centered">' . $temp->render(80) . '</div>'; $html .= $this->renderSecurityFields(); $html .= '</form>'; $html .= '<p><a href="' . FrontController::generateSecureURL('act=Alpha\\Controller\\LoginController&reset=true') . '">Forgotten your password?</a></p>'; $html .= '</div>'; return $html; }
/** * Constructor for the class that populates all of the complex types with default values. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('Person'); self::$logger->debug('>>__construct()'); // ensure to call the parent constructor parent::__construct(); $this->displayName = new String(); $this->displayName->setRule(Validator::REQUIRED_USERNAME); $this->displayName->setSize(70); $this->displayName->setHelper('Please provide a name for display on the website (only letters, numbers, and .-_ characters are allowed!).'); $this->email = new String(); $this->email->setRule(Validator::REQUIRED_EMAIL); $this->email->setSize(70); $this->email->setHelper('Please provide a valid e-mail address as your username.'); $this->password = new String(); $this->password->setSize(70); $this->password->setHelper('Please provide a password for logging in.'); $this->password->isPassword(true); $this->state = new Enum(array('Active', 'Disabled')); $this->state->setValue('Active'); $this->URL = new String(); $this->URL->setRule(Validator::OPTIONAL_HTTP_URL); $this->URL->setHelper('URLs must be in the format http://some_domain/ or left blank!'); // add unique keys to displayName and email (which is effectively the username in Alpha) $this->markUnique('displayName'); $this->markUnique('email'); $this->rights = new Relation(); $this->markTransient('rights'); $this->actions = new Relation(); $this->markTransient('actions'); $this->setupRels(); self::$logger->debug('<<__construct'); }