Guest User

Untitled

a guest
Mar 13th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public function login()
  2. {
  3. if($this->ion_auth->logged_in()){
  4. redirect(base_url('user/profile'), 'refresh');
  5. }
  6. $username = $email = $this->input->post('email');
  7. $identity = $email;
  8. $password = $this->input->post('password');
  9. if ($this->ion_auth->login($identity, $password))
  10. {
  11. $user_details=$this->ion_auth->user()->row();
  12. $this->session->set_userdata('first_name',$user_details->first_name);
  13. $this->session->set_userdata('last_name',$user_details->last_name);
  14. $this->session->set_flashdata('message_success', $this->ion_auth->messages());
  15. if($this->ion_auth->is_admin())
  16. {
  17. redirect(base_url('admin/dashboard'), 'refresh');
  18. }
  19. else
  20. {
  21. redirect(base_url('user/profile'), 'refresh');
  22. }
  23. }
  24. else
  25. {
  26. $this->session->set_flashdata('message_error', $this->ion_auth->errors());
  27. redirect(base_url('page/signup'), 'refresh');
  28. }
  29.  
  30. }
Add Comment
Please, Sign In to add comment