Ejemplo n.º 1
0
 public function authenticate()
 {
     $u = Request::get('username');
     $p = Request::get('password');
     $g = User::ClientUsername($u)->ClientPassword(md5($p))->get();
     if (!empty($u) && !empty($p)) {
         if ($g->count() > 0) {
             $this->response_text = "Login Successful";
             $this->response_status = "Success";
             Auth::login(User::find($g[0]->id));
             $this->_setSession($g[0]);
             //print_r(Session::get(''));
             //print_r($g[0]->id);
         } else {
             $this->response_text = "Invalid Email/Password";
             $this->response_status = "Failed";
         }
     } else {
         $this->response_text = "Email and password are required.";
         $this->response_status = "Failed";
     }
     return array("status" => $this->response_status, "msg" => $this->response_text);
     //print_r($g[0]->roles[0]->role_name);
 }
Ejemplo n.º 2
0
 private function _userAuthenticate($user_info)
 {
     SomeClass::userInitSession($user_info);
     $user = User::find($user_info['user_id']);
     // user_id test 1 is mark.tan
     Auth::login($user);
 }