public function login($identity, $duration = 0) { if ($identity->model instanceof CModel) { $this->model = $identity->model; } return parent::login($identity, $duration = 0); }
/** * @param IUserIdentity $identity * @param int $duration * @return bool */ public function login($identity, $duration = 0) { $this->setState("__branchId", $identity->getBranchId()); $this->setState("__scope", $identity->getScope()); $this->setState("__roles", $identity->getRoles()); $this->setState("__userData", $identity->getUserData()); return parent::login($identity, $duration); }
public function login($identity, $duration = 0) { parent::login($identity, $duration); $auth = Yii::app()->authManager; if (!$auth->isAssigned(Yii::app()->user->role, Yii::app()->user->id)) { if ($auth->assign(Yii::app()->user->role, Yii::app()->user->id)) { Yii::app()->authManager->save(); } } }
public function login($identity, $duration = 0) { if (@strlen(Yii::app()->params['admin_ips'])) { $model = User::model()->findByPk($identity->id); if ($model->global_role == 'superuser' || $model->name == $this->superuser) { if (!$this->checkIp(Yii::app()->params['admin_ips'])) { Yii::log('Superuser login denied for ' . $model->name . ' (IP ' . $this->ip . ')'); return false; } } } return parent::login($identity, $duration); }
public function login($identity, $duration = 0) { $result = parent::login($identity, $duration); if (!$result) { return $result; } $session = Yii::app()->getSession(); $info = UserInfo::model()->findByAttributes(['user_id' => $identity->getId()]); $session['username'] = $info->name; $session['surname'] = $info->surname; $session['otchestvo'] = $info->otchestvo; return $result; }
/** * @runInSeparateProcess * @outputBuffering enabled * @dataProvider booleanProvider */ public function testLoginLogout($destroySession) { $identity = new CUserIdentity('testUser', 'testPassword'); $user = new CWebUser(); $user->init(); // be guest before login $this->assertTrue($user->isGuest); // do a login $this->assertTrue($user->login($identity)); // don't be guest after login $this->assertFalse($user->isGuest); $this->assertEquals('testUser', $user->getId()); $this->assertEquals('testUser', $user->getName()); $user->logout($destroySession); // be guest after logout $this->assertNull($user->getId()); $this->assertEquals($user->guestName, $user->getName()); }
public function login($identity, $duration = 0) { $this->setState('__userInfo', $identity->getUser()); parent::login($identity, $duration); }
add_audit(AUDIT_ACTION_LOGOUT, AUDIT_RESOURCE_USER, _('Manual Logout')); CWebUser::logout(); } $config = select_config(); if ($config['authentication_type'] == ZBX_AUTH_HTTP) { if (!empty($_SERVER['PHP_AUTH_USER'])) { $_REQUEST['enter'] = _('Sign in'); $_REQUEST['name'] = $_SERVER['PHP_AUTH_USER']; } else { access_deny(); } } // login via form if (isset($_REQUEST['enter']) && $_REQUEST['enter'] == _('Sign in')) { // try to login if (CWebUser::login(get_request('name', ''), get_request('password', ''))) { // save remember login preference $user = array('autologin' => get_request('autologin', 0)); if (CWebUser::$data['autologin'] != $user['autologin']) { $result = API::User()->updateProfile($user); } add_audit_ext(AUDIT_ACTION_LOGIN, AUDIT_RESOURCE_USER, CWebUser::$data['userid'], '', null, null, null); $request = get_request('request'); $url = zbx_empty($request) ? CWebUser::$data['url'] : $request; if (zbx_empty($url) || $url == $page['file']) { $url = 'dashboard.php'; } redirect($url); exit; } else { CWebUser::checkAuthentication(null);
/** * Login Function * * @param UserIndentity $identity * @param int $duration */ public function login($identity, $duration) { parent::login($identity, $duration); //Yii::app()->getSession()->remove('current_user'); //Yii::app()->getSession()->add('current_user', $identity->getModel()); }
} $config = select_config(); if ($config['authentication_type'] == ZBX_AUTH_HTTP) { if (!empty($_SERVER['PHP_AUTH_USER'])) { $_REQUEST['enter'] = _('Sign in'); $_REQUEST['name'] = $_SERVER['PHP_AUTH_USER']; } else { access_deny(ACCESS_DENY_PAGE); } } // login via form if (isset($_REQUEST['enter']) && $_REQUEST['enter'] == _('Sign in')) { // try to login $autoLogin = getRequest('autologin', 0); DBstart(); $loginSuccess = CWebUser::login(getRequest('name', ''), getRequest('password', '')); DBend(true); if ($loginSuccess) { // save remember login preference $user = array('autologin' => $autoLogin); if (CWebUser::$data['autologin'] != $autoLogin) { API::User()->updateProfile($user); } $request = getRequest('request'); $url = zbx_empty($request) ? CWebUser::$data['url'] : $request; if (zbx_empty($url) || $url == $page['file']) { $url = 'dashboard.php'; } redirect($url); exit; } else {
/** * Login Function * * @param UserIndentity $identity * @param int $duration */ public function login($identity, $duration = 3600) { return parent::login($identity, $duration); }
public function login($identity, $duration = 0) { parent::login($identity, $duration); Yii::app()->user->setState('sp', $identity->getSp()); return !$this->getIsGuest(); }
/** * {@inheritdoc} * * @param \IUserIdentity $identity The user identity (which should already * be authenticated). * @param integer $duration Number of seconds that the user can * remain in logged-in status. Defaults to * 0, meaning login till the user closes the * browser. * @param boolean $mute Defines if this method should generate * flash user messages. * * @return boolean Whether the user is logged in. * @since 0.1.0 */ public function login($identity, $duration = 0, $mute = false) { if (!$this->getIsGuest()) { if (!$mute) { $this->sendNotice('auth.login.alreadyAuthorized'); } return true; } $result = parent::login($identity, $duration); if (!$mute) { if ($result) { $this->sendSuccessMessage('auth.login.greeting'); } else { $this->sendErrorMessage('auth.login.fail'); } } return $result; }
/** * @param WebUserIdentity * @param int */ public function login($identity, $duration = 0) { parent::login($identity, $duration); Yii::app()->getSession()->add('isAdmin', $identity->getIsAdmin()); Yii::app()->getSession()->add('roleId', $identity->getRoleId()); }
/** * @param IUserIdentity $identity * @param int $duration * @return bool */ public function login($identity, $duration = 0) { if ($duration) { //создать токен $token = Yii::app()->userManager->tokenStorage->createCookieAuthToken($this->getProfile(), $duration); $identity->setState($this->authToken, $token->token); } return parent::login($identity, $duration); }