@param array   $credentials
@param bool    $remember
@param bool    $login
@param integer $appId

@return bool
@throws \Exception
425209
public static function authenticate(array $credentials, $remember = false, $login = true, $appId = null)
    {
        if (\Auth::attempt($credentials)) {
            $user = \Auth::getLastAttempted();
            /** @noinspection PhpUndefinedFieldInspection */
            static::checkRole($user->id);
            if ($login) {
                /** @noinspection PhpUndefinedFieldInspection */
                $user->last_login_date = Carbon::now()->toDateTimeString();
                /** @noinspection PhpUndefinedFieldInspection */
                $user->confirm_code = 'y';
                /** @noinspection PhpUndefinedMethodInspection */
                $user->save();
                /** @noinspection PhpParamsInspection */
                Session::setUserInfoWithJWT($user, $remember, $appId);
            }

            return true;
        } else {
            return false;
        }
    }
359232
public function attempt(array $credentials)
    {
        if (! $this->auth->byCredentials($credentials)) {
            return false;
        }

        return $this->fromUser($this->user());
    }
955984
public function retrieveByCredentials(array $credentials): ?UserContract
    {
        $name = Authen::getIdentifierName();

        if (! isset($credentials[$name]) || empty($credentials[$name])) {
            return parent::retrieveByCredentials($credentials);
        }

        $identifier = $credentials[$name];
        unset($credentials[$name]);

        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // Eloquent User "model" that will be utilized by the Guard instances.

        $query = $this->createModel()
                    ->newQuery()
                    ->findByIdentifiers($identifier);

        foreach ($credentials as $key => $value) {
            if (! Str::contains($key, 'password')) {
                $query->where($key, $value);
            }
        }

        return $query->first();
    }
1123878
public static function loginUsingId( $id, $remember = false )
	{
		return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
	}
1057399
public function persist($appKey, $sessionToken)
    {
        if ($sessionToken === null) {
            throw new Exception('Invalid session token');
        }

        self::$appKey = $appKey;
        self::$sessionToken = $sessionToken;

        return $this->keepAlive();
    }
195319
public function register(array $credentials, $activate)
    {
        try
        {
            if ( $this->validator->with($credentials)->passes() )
            {
                $this->users->register($credentials,$activate);
                return true;
            }
        }
        catch (LoginRequiredException $e)
        {
            $this->validator->add('LoginRequiredException',$e->getMessage());
        }
        catch (PasswordRequiredException $e)
        {
            $this->validator->add('PasswordRequiredException',$e->getMessage());
        }
        catch (UserExistsException $e)
        {
            $this->validator->add('UserExistsException',$e->getMessage());
        }

        return false;
    }
1336778
public function loginUsingId( $id, $remember = false )
	{
		$acct = $this->auth->retrieveById( $id );

		if ( !is_null( $acct ) )
		{
			$this->login( $acct, $remember );

			return $acct;
		}

		return false;
	}
1187244
public function toLogin($callback,$appId)
	{
		// $signature = 
		$loginUrl = $this->_config['loginView'].$this->signature().'&appId='.$appId.'&callback='.$callback;
		header('Location:'.$loginUrl);
	}
149342
public function authenticate($credentials, $remember = false, $login = true)
    {
        return $this->sentinel->authenticate($credentials, $remember, $login);
    }
1299615
public function authenticate(array $credentials, $remember = false)
    {
        $user = $this->sentry->authenticate($credentials,$remember);
        $this->event->fire('users.login',array($user));
        return $user;
    }
800046
public function login($login, $password, $remindme = true)
  {
    $this->user = $this->findUser($login, $password);

    return $this->user
      ? $this->saveToken($remindme)
      : false;
  }
718312
public function login(UserInterface $user, $remember = false)
    {
        $this->updateSession($user->getAuthIdentifier());

        // If the user should be permanently "remembered" by the application we will
        // queue a permanent cookie that contains the encrypted copy of the user
        // identifier. We will then decrypt this later to retrieve the users.
        if ($remember) {
            $this->createRememberTokenIfDoesntExist($user);

            $this->queueRecallerCookie($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->dispatch('auth.login', array($user, $remember));
        }

        $this->setUser($user);
    }
721002
public function setCredentials($appId, $secretKey)
    {
        $this->appId = $appId;
        $this->secretKey = $secretKey;
        return $this;
    }
482286
public function loginAs(int $user_id, bool $remember = false): bool
    {
        if (!$user_id) {
            return false; // Impossible.
        }
        $on_set_auth_cookie = function (string $value) {
            $_COOKIE[is_ssl() ? SECURE_AUTH_COOKIE : AUTH_COOKIE] = $value;
        };
        $on_set_logged_in_cookie = function (string $value) {
            $_COOKIE[LOGGED_IN_COOKIE] = $value;
        };
        add_action('set_auth_cookie', $on_set_auth_cookie);
        add_action('set_logged_in_cookie', $on_set_logged_in_cookie);

        wp_clear_auth_cookie();
        wp_set_auth_cookie($user_id, $remember);

        remove_action('set_auth_cookie', $on_set_auth_cookie);
        remove_action('set_logged_in_cookie', $on_set_logged_in_cookie);

        wp_set_current_user(0);
        wp_set_current_user($user_id);

        return (int) get_current_user_id() === $user_id;
    }
465065
private function _getRememberMeCredentials()
    {
        $credentials = array();
        $remember = get_hash('AN_LOGIN_REMEMBER');

        if (isset($_COOKIE[$remember]) && !empty($_COOKIE[$remember])) {
            $key = get_hash('AN_LOGIN_REMEMBER', 'md5');
            $crypt = $this->getService('anahita:encrypter', array('key' => $key, 'cipher' => 'AES-256-CBC'));
            $cookie = $crypt->decrypt($_COOKIE[$remember]);

            try {
                $credentials = (array) unserialize($cookie);
            } catch (RuntimeException $e) {
                error_log($e->getMessage());
            }
        }

        return $credentials;
    }
602178
public function getCredentials(array $parameters = array(), $multipart = false, $appOnlyAuth = false)
    {
        return $this->getAccountVerifyCredentials($parameters, $multipart, $appOnlyAuth);
    }
749581
public function attempt(array $credentials = [], $remember = false, $login = true)
    {
        // we do thing if the user is allowed to login with only username or
        // only password
        if ((config('taki.login_by') == 'both') && isset($credentials[config('taki.field.both')])) {
            $login = $credentials[config('taki.field.both')];
            unset($credentials[config('taki.field.both')]);
            if (isset($credentials[config('taki.field.username')])) {
                unset($credentials[config(['taki.field.username'])]);
            }
            if (isset($credentials[config('taki.field.email')])) {
                unset($credentials[config('taki.field.email')]);
            }
            if (filter_var($login, FILTER_VALIDATE_EMAIL)) {
                $credentials[config('taki.field.email')] = $login;
            } else {
                $credentials[config('taki.field.username')] = $login;
            }
        }

        return $this->auth->attempt($credentials, $remember, $login);
    }