buildCommonNS(); $out['errors'] = array(); $form = new HTML_QuickForm('login_form', 'POST', 'login'); $form->addElement('text', 'login_username', 'Username', array('maxlength'=>50)); $form->addElement('password', 'login_password', 'Password', array('maxlength'=>255)); $form->addElement('submit', 'login', 'Login'); $form->addRule('login_username', 'Need a username', 'required'); $form->addRule('login_password', 'Password is blank', 'required'); // Attempt to validate the login form and then try actually logging in. if ($form->validate()) { $this->auth->logout(); $this->auth->start(); if (!$this->auth->checkAuth()) { array_push($out['errors'], 'Invalid login.'); } else { $form->freeze(); header("Location: ".$out['BASE_URL']."/people/".$this->auth->getUsername()); } } // Extract the results of form validation in an array for the template. $renderer = new HTML_QuickForm_Renderer_Array(); $form->accept($renderer); $out['form'] = $renderer->toArray(); echo $this->renderTemplate('login', $out); ?>