Log a acct into the application.

@param  Account $acct
@param  bool $remember
966605
public static function login( Account $acct, $remember = false )
	{
		static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
	}
372859
public function remember(string $key, \Closure $getValueCallback, int $expire = null)
    {
        if (($fromCache = $this->get($key)) !== false) {
            return $fromCache;
        }

        $this->set($key, $value = $getValueCallback(), $expire);

        return $value;
    }
1183084
public function remember($key, $minutes, Closure $callback)
    {
        return $this->cache->remember($key, $minutes, $callback);
    }
642387
public function login(array $credentials, $remember)
    {
        try
        {
            $this->users->authenticate($credentials,$remember);
            return true;
        }
        catch (LoginRequiredException $e)
        {
            $this->validator->add('LoginRequiredException', $e->getMessage());
        }
        catch (PasswordRequiredException $e)
        {
            $this->validator->add('PasswordRequiredException', $e->getMessage());
        }
        catch (WrongPasswordException $e)
        {
            $this->validator->add('WrongPasswordException', $e->getMessage());
        }
        catch (UserNotActivatedException $e)
        {
            $this->validator->add('UserNotActivatedException', $e->getMessage());
        }
        catch (UserNotFoundException $e)
        {
            $this->validator->add('UserNotFoundException', $e->getMessage());
        }
        catch (UserSuspendedException $e)
        {
            $this->validator->add('UserSuspendedException', $e->getMessage());
        }
        catch (UserBannedException $e)
        {
            $this->validator->add('UserBannedException', $e->getMessage());
        }

        return false;
    }
631227
public function setIdentity(Identity $user, $remember = false)
    {
        $this->identity = $user;

        Application::$instance->getResponse()->addCookie(self::TOKEN_NAME,
            $user->getAuthToken(),
            $remember ? time() + 365 * 24 * 60 * 60 : null, '/');
        return $this;
    }
376464
private function processRememberDirective() {
		// if the user is not signed in yet
		if (!$this->isLoggedIn()) {
			// if there is currently no cookie for the 'remember me' feature
			if (!isset($_COOKIE[$this->rememberCookieName])) {
				// if an old cookie for that feature from versions v1.x.x to v6.x.x has been found
				if (isset($_COOKIE['auth_remember'])) {
					// use the value from that old cookie instead
					$_COOKIE[$this->rememberCookieName] = $_COOKIE['auth_remember'];
				}
			}

			// if a remember cookie is set
			if (isset($_COOKIE[$this->rememberCookieName])) {
				// assume the cookie and its contents to be invalid until proven otherwise
				$valid = false;

				// split the cookie's content into selector and token
				$parts = \explode(self::COOKIE_CONTENT_SEPARATOR, $_COOKIE[$this->rememberCookieName], 2);

				// if both selector and token were found
				if (!empty($parts[0]) && !empty($parts[1])) {
					try {
						$rememberData = $this->db->selectRow(
							'SELECT a.user, a.token, a.expires, b.email, b.username, b.status, b.roles_mask, b.force_logout FROM ' . $this->makeTableName('users_remembered') . ' AS a JOIN ' . $this->makeTableName('users') . ' AS b ON a.user = b.id WHERE a.selector = ?',
							[ $parts[0] ]
						);
					}
					catch (Error $e) {
						throw new DatabaseError($e->getMessage());
					}

					if (!empty($rememberData)) {
						if ($rememberData['expires'] >= \time()) {
							if (\password_verify($parts[1], $rememberData['token'])) {
								// the cookie and its contents have now been proven to be valid
								$valid = true;

								$this->onLoginSuccessful($rememberData['user'], $rememberData['email'], $rememberData['username'], $rememberData['status'], $rememberData['roles_mask'], $rememberData['force_logout'], true);
							}
						}
					}
				}

				// if the cookie or its contents have been invalid
				if (!$valid) {
					// mark the cookie as such to prevent any further futile attempts
					$this->setRememberCookie('', '', \time() + 60 * 60 * 24 * 365.25);
				}
			}
		}
	}
167210
protected function performLogin($user, $rememberMe = true)
    {
        // log user in
        $loginDuration = $rememberMe ? $this->module->loginDuration : 0;
        Yii::$app->user->login($user, $loginDuration);

        // check for a valid returnUrl (to prevent a weird login bug)
        //   https://github.com/amnah/yii2-user/issues/115
        $loginRedirect = $this->module->loginRedirect;
        $returnUrl = Yii::$app->user->getReturnUrl($loginRedirect);
        if (strpos($returnUrl, "user/login") !== false || strpos($returnUrl, "user/logout") !== false) {
            $returnUrl = null;
        }

        return $returnUrl;
    }
1161609
public function login($credentials = array(), $remember = false, $secure = false)
	{
		$creds = array();

		$creds[$this->getLoginField()] = $this->getLoginCredential($credentials);

		$creds[$this->getPasswordField()] = $this->getPasswordCredential($credentials);

		$creds['remember'] = $remember;

		$user = wp_signon($creds, $secure);

		/**
		 * throw exception encapsulation of WP_Error
		 */
		if (is_wp_error($user))
		{
			throw new LoginFailedException($user);
		}

		// If we have an event dispatcher instance set we will fire an event so that
		// any listeners will hook into the authentication events and run actions
		// based on the login and logout events fired from the guard instances.
		if (isset($this->events))
		{
			$this->events->fire('auth.login', array($user, $remember));
		}

		$this->setUser($user);

		return true;
	}
405457
public function setAcct( Account $acct )
	{
		$this->acct = $acct;
		$this->loggedOut = false;

		return $this;
	}
811235
public function authorize($remember)
    {
        $uniq = md5 (uniqid (rand()));
		$conn = self::getDbConnection();
        $conn->executeQuery('UPDATE '.User::TABLE.' SET last_login=NOW() WHERE id='.$this->id);
		$s = Application::getInstance()->getVar('auth_inactivity_seconds');
		if (!$s) $s = AUTH_INACTIVITY_SECONDS;
		$conn->executeQuery('DELETE FROM users_auth WHERE remember = 0 and time < ?', [time()-$s]);
        $conn->executeQuery('INSERT INTO users_auth SET user_id='.$this->id.', remember='.(int)$remember.',uniq="'.$uniq.'", ip="'.$_SERVER['REMOTE_ADDR'].'", time='.time());
        return $uniq;
    }
1169045
synchronized void resetAccounting(long newLastTime) {
        long interval = newLastTime - lastTime.getAndSet(newLastTime);
        if (interval == 0) {
            // nothing to do
            return;
        }
        if (logger.isDebugEnabled() && interval > checkInterval() << 1) {
            logger.debug("Acct schedule not ok: " + interval + " > 2*" + checkInterval() + " from " + name);
        }
        lastReadBytes = currentReadBytes.getAndSet(0);
        lastWrittenBytes = currentWrittenBytes.getAndSet(0);
        lastReadThroughput = lastReadBytes * 1000 / interval;
        // nb byte / checkInterval in ms * 1000 (1s)
        lastWriteThroughput = lastWrittenBytes * 1000 / interval;
        // nb byte / checkInterval in ms * 1000 (1s)
        realWriteThroughput = realWrittenBytes.getAndSet(0) * 1000 / interval;
        lastWritingTime = Math.max(lastWritingTime, writingTime);
        lastReadingTime = Math.max(lastReadingTime, readingTime);
    }
1258006
public function forceUser(UserInterface $user, $remember = true)
    {
        $user = $this->sentinel->authenticate($user, $remember);

        if ( ! ($user instanceof CartalystUserInterface)) {
            return false;
        }

        event( new CmsUserLoggedIn($user, false, true) );
        return true;
    }
787293
protected function queueRecallerCookie( Account $acct )
	{
		$value = $acct->getId() . '|' . $acct->getRememberToken();

		$this->getCookieJar()->queue( $this->createRecaller( $value ) );
	}
1197815
public function persistClientToken($clientId, $accessToken, $expiration, $role)
    {
        /** @var \Illuminate\Database\Query\Builder $table */
        $table = app('db')->connection()->table('clients');

        // If the record doesn't already exist, add it.
        if (! $table->where(['client_id' => $clientId])->exists()) {
            $table->insert(['client_id' => $clientId]);
        }

        // Update record with the new access token & expiration.
        $table->where(['client_id' => $clientId])->update([
            'access_token' => $accessToken,
            'access_token_expiration' => $expiration,
        ]);
    }
117736
public static function attempt( array $credentials = [], $remember = false, $login = true )
	{
		return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
	}
1123878
public static function loginUsingId( $id, $remember = false )
	{
		return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
	}
437855
protected function fireAttemptEvent(array $credentials, $remember, $login)
	{
		if ($this->events)
		{
			$payload = array($credentials, $remember, $login);

			$this->events->fire('auth.attempt', $payload);
		}
	}