Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array(0) {
- <?php echo form_open("auth/login");?>
- <div class="form-group">
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-user"></i>
- </span>
- <?php echo form_input($identity);?>
- </div>
- </div>
- <div class="form-group">
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-lock"></i>
- </span>
- <?php echo form_input($password);?>
- </div>
- </div>
- <button type="submit" class="btn btn-primary text-theme-xs mr-8">Login</button>
- <?php echo form_checkbox('remember', '1', FALSE, 'id="remember"');?>
- <a href="<?= site_url('auth/forgot_password') ?>" class="text-theme-xs pull-right a-black">Forgot your password ?</a>
- </form>
- function login()
- {
- $this->data['title'] = "Login";
- //validate form input
- $this->form_validation->set_rules('identity', 'Identity', 'required');
- $this->form_validation->set_rules('password', 'Password', 'required');
- if ($this->form_validation->run() == true)
- {
- //check to see if the user is logging in
- //check for "remember me"
- $remember = (bool) $this->input->post('remember');
- if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))
- {
- //if the login is successful
- //redirect them back to the home page
- $this->session->set_flashdata('message', $this->ion_auth->messages());
- redirect('/', 'refresh');
- }
- else
- {
- //if the login was un-successful
- //redirect them back to the login page
- $this->session->set_flashdata('message', $this->ion_auth->errors());
- redirect('auth/login', 'refresh'); //use redirects instead of loading views for compatibility with MY_Controller libraries
- }
- }
- else
- {
- //the user is not logging in so display the login page
- //set the flash data error message if there is one
- $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
- $this->data['identity'] = array('name' => 'identity',
- 'id' => 'identity',
- 'type' => 'text',
- 'class' => 'form-control',
- 'value' => $this->form_validation->set_value('identity'),
- 'placeholder' => 'Username',
- );
- $this->data['password'] = array('name' => 'password',
- 'id' => 'password',
- 'type' => 'password',
- 'class' => 'form-control',
- 'placeholder' => 'Password',
- );
- $this->_render_page('templates/head', $this->data);
- $this->_render_page('templates/navbar', $this->data);
- $this->_render_page('auth/login', $this->data);
- $this->_render_page('templates/footer', $this->data);
- }
- }
- <form action="http://www.mydomain.uk/auth/login" method="post" accept-charset="utf-8">
- <p>
- <label for="identity">Email/Username:</label> <input type="text" name="identity" value="" id="identity" class="form-control" placeholder="Username" />
- </p>
- <p>
- <label for="password">Password:</label> <input type="password" name="password" value="" id="password" class="form-control" placeholder="Password" />
- </p>
- <p>
- <label for="remember">Remember Me:</label> <input type="checkbox" name="remember" value="1" id="remember" />
- </p>
- <p><input type="submit" name="submit" value="Login" />
- </p>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement