Ejemplo n.º 1
0
 /**
  * 登录验证
  *
  * @param string $username 用户名
  * @param string $password 密码
  * @access public
  * @return boolean false|用户的信息
  */
 public function check($username, $password)
 {
     $userInfo = $this->userModel->InfoByName($username);
     $sign = md5($userInfo['password'] . $this->getPublicKey());
     $this->delPublicKey();
     if ($sign == strtolower($password)) {
         $data['last_login_time'] = time();
         $data['last_login_ip'] = Request::ip();
         $this->userModel->updateLastLoginInfo($userInfo->id, $data);
         SC::setLoginSession($userInfo);
         SC::setAllPermissionSession($this->permissionModel->getAllAccessPermission());
         event(new \App\Events\Admin\ActionLog(Lang::get('login.login_sys'), ['userInfo' => $userInfo]));
         return $userInfo;
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * 登录验证,验证成功后会设置一些待用的session
  *
  * @param string $username 用户名
  * @param string $password 密码
  * @return boolean false | 用户的信息
  * @access public
  */
 public function check($username, $password)
 {
     $userInfo = $this->userModel->InfoByName($username);
     $sign = md5($userInfo['password'] . $this->getPublicKey());
     if ($sign != strtolower($password)) {
         return false;
     }
     $data['last_login_time'] = time();
     $data['last_login_ip'] = Request::ip();
     $this->userModel->updateLastLoginInfo($userInfo->id, $data);
     $allPermission = $this->permissionModel->getAllAccessPermission();
     SC::setLoginSession($userInfo);
     SC::setUserCurrentTime();
     SC::setAllPermissionSession($allPermission);
     Cache::store('file')->forever(SC::ALL_PERMISSION_KEY, $allPermission);
     $log = new ActionLog(Lang::get('login.login_sys'), ['userInfo' => $userInfo]);
     event($log);
     return $userInfo;
 }