-
-
Save orourkek/12e5d6d8898b736af9d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function login() | |
{ | |
$this->enforce_loggedout(); | |
$data['content_data']['error_state'] = false; | |
$data['content_data']['form_action'] = ''; | |
if($this->input->post('login-submit') !== false) | |
{ #login form was submitted, check the data | |
$un = $this->input->post('username'); | |
$pw = $this->input->post('password'); | |
if(!$un || !$pw) | |
{ | |
$data['content_data']['error_state'] = true; | |
} | |
else | |
{ | |
$loginResult = $this->sslogin->login($un, $pw); | |
if($loginResult === false) | |
{ | |
$data['content_data']['error_state'] = true; | |
$data['content_data']['username'] = $un; | |
} | |
} | |
if($data['content_data']['error_state'] === false) | |
{ #redirect them back away, successful login! | |
if($this->input->post('orig_referer')) | |
{ | |
redirect($this->input->post('orig_referer'), 'location'); | |
} | |
redirect('', 'location'); | |
} | |
} | |
//show the login page | |
$data['header_data']['title'] = 'Login'; | |
$data['header_data']['navActive'] = null; | |
$data['header_data']['userbar'] = $this->userbar->init(); | |
$data['content_view'] = 'account/login'; | |
$this->load->view('master', $data); | |
} | |
/* Pseudocode: | |
Login form submitted? | |
yes: validate form data | |
data valid? | |
yes: redirect | |
no: continue | |
no: continue | |
show the login page | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment