예제 #1
0
 function login()
 {
     $token = tokenGenerate();
     $this->CI->m_security->filterPost('muser_' . $token, 'trim|required|min_length[1]');
     $this->CI->m_security->filterPost('mpass_' . $token, 'trim|required|min_length[1]');
     if ($this->CI->m_security->startPost() == TRUE) {
         $user = $this->CI->input->post('muser_' . $token, TRUE);
         $pass = $this->CI->input->post('mpass_' . $token, TRUE);
         $remember = $this->CI->input->post('mremember');
         $rememberX = '0';
         if ($remember) {
             $rememberX = '1';
         } else {
             $rememberX = '0';
         }
         $this->CI->load->library('auth/abstractauth');
         $proses = $this->CI->abstractauth->loginDo($user, $pass, $rememberX);
         if ($proses == FALSE) {
             redirect(base_url(routeGet('login') . '?s=2'), 'refresh');
         } else {
             runService('login', 'destroy');
             $checkUser = array('username' => $user);
             $userid = $this->CI->m_database->fieldRow('userlogin', $checkUser, 'user_id');
             $role = taxonomyRead($userid, 'role_user');
             $this->createSessionLogin($user, $role, $rememberX);
             redirect(base_url() . roleDirectUser(), 'refresh');
         }
     } else {
         redirect(base_url(routeGet('login') . '?s=1'), 'refresh');
     }
 }
예제 #2
0
 function index()
 {
     if ($this->hasUser() == TRUE) {
         if ($this->m_auth->isLogin() == TRUE) {
             redirect(base_url() . roleDirectUser(), 'refresh');
         } else {
             $meta['judul'] = "User Login";
             $this->load->view('header', $meta);
             $this->load->view('loginview');
             $this->load->view('footer');
         }
     } else {
         redirect(base_url(routeGet('freshinstall', 'route_key')), 'refresh');
     }
 }