Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login() {
- // If they are already logged in
- if($this->isLoggedIn() !== false) {
- $this->postLoginRedirect();
- }
- // Initialise the form
- $this->oForm->init('user_login', '', 'post');
- // Set form structure
- $this->oForm->setFormStructure($this->oUser->_loginFormStructure);
- // If we have submitted out form
- if($this->oForm->isSubmitted()) {
- // Get the form values
- $aSubmitValues = $this->oForm->getSubmitValues();
- // Perform a login and if it details then set an error on the 'email' field.
- if(!($bRet = $this->oUser->login(trim($aSubmitValues['email']), trim($aSubmitValues['password'])))) {
- $this->oForm->setElementError('email', 'Login Failed. Please check your credentials and try again.');
- }
- // If login was successfull then we redirect them to somewhere.
- if($this->oForm->isValidated()) {
- $this->postLoginRedirect();
- }
- }
- // Get our formbuilder rendering information
- $viewValues = array(
- 'formBuilder' => $this->oForm->getRenderInformation()
- );
- // Load the login page.
- $this->loadSmarty('user/login', $viewValues);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement