Logs in a user.

@param array $user     The user as an array
@param bool  $remember Flag to whether remember the user or not

@return bool
491958
public function login(array $credentials, $remember = true)
    {
        $uniqueAlias = strpos($credentials['username'], '@') ? 'email' : 'username';
        $person = $this->getService('repos:people.person')->find(array(
            $uniqueAlias => $credentials['username'],
            'enabled' => 1
        ));

        if (is_null($person)) {
            $msg = "Did not find a user with username: ".$credentials['username'];
            throw new AnErrorException($msg, AnHttpResponse::UNAUTHORIZED);
        } else {
            $person->visited();
            $this->_createSession($person);

            $results = dispatch_plugin('user.onAfterLoginPerson', array('person' => $person));
            foreach ($results as $result) {
                if ($result instanceof Exception || $result === false) {
                    return false;
                }
            }
        }

        // create a remember cookie that contains the ecrypted username and password
        if ($remember) {
            $key = get_hash('AN_LOGIN_REMEMBER', 'md5');
            $crypt = $this->getService('anahita:encrypter', array('key' => $key, 'cipher' => 'AES-256-CBC'));
            $cookie = $crypt->encrypt(serialize(array(
                'username' => $credentials['username'],
                'password' => $credentials['password'],
            )));
            $oneYear = 365 * 24 * 3600;
            $hash = get_hash('AN_LOGIN_REMEMBER');
            setcookie($hash, $cookie, time() + $oneYear, '/');
        }

        return $person;
    }
73800
public function setUser(array $user)
    {
        if (in_array('user', $this->persistantMap)) {
            $this->store->set('user', $user);
        }

        $this->user = $user;
        return $this;
    }
1288753
public function login($user, $password)
    {
        $creds = array();
        $creds['user_login'] = $user;
        $creds['user_password'] = $password;
        $creds['remember'] = true;
        $user = wp_signon($creds, false);
        if (is_wp_error($user)) {
            return false;
        } else {
            return true;
        }
    }
1174272
public function login($user, $password)
    {
        return $this->requestAndResponse('LOGIN', $this->escapeString($user, $password), true);
    }
117736
public static function attempt( array $credentials = [], $remember = false, $login = true )
	{
		return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
	}
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;
        }
    }
366758
public function login($username, $password, $remember = 1)
	{
		$event = new Event('onPlatformLogin');
		$event->addArgument('username', $username);
		$event->addArgument('password', $password);
		$event->addArgument('remember', $remember);
		$event->addArgument('activePlugin', $this->activePlugin);

		Factory::getDispatcher()->triggerEvent($event);
	}
1243141
public function updateRememberToken(UserContract $user, $token)
    {
        $this->query->filterById($user->getAuthIdentifier())
            ->update(['RememberToken' => $token]);
    }
1167054
protected function verifyUser($user, $password)
    {
        if (!isset($this->userList[$user]))
        {
            return false;
        }
        if ($this->userList[$user] != $password)
        {
            return false;
        }
        return true;
    }
275301
public function login($email, $password, $remember = false)
	{
		$user = User::where('email', $email)->first();

		if ($user and Hash::check($password, $user->password))
		{
			$this->auth->login($user, $remember);

			return true;
		}

		return false;
	}
1346939
public function loginUser($user = null, $properties = array())
    {
        if($this->_login_user && $user)
        {
            //Get the user data
            if(!is_array($user))
            {
                if($user instanceof UserInterface) {
                    $user = $user->toArray();
                } else {
                    $user = $this->getObject('user.provider')->getUser($user)->toArray();
                }
            }

            //Set the user properties
            $properties = array_merge($properties, (array) $user);

            $this->getObject('user')->setProperties($properties);
            $this->getObject('user')->setAuthentic();

            return true;
        }

        return false;
    }
309349
public function loadUser($user) {
        global $DB;

        $userid = $user->getRecordId();
        $fields = 'id, resourcelinkid, ltiuserkey, ltiresultsourcedid, created, updated';
        if (!empty($userid)) {
            $row = $DB->get_record($this->userresulttable, ['id' => $userid], $fields);
        } else {
            $resourcelinkid = $user->getResourceLink()->getRecordId();
            $userid = $user->getId(ToolProvider\ToolProvider::ID_SCOPE_ID_ONLY);
            $row = $DB->get_record_select(
                $this->userresulttable,
                "resourcelinkid = ? AND ltiuserkey = ?",
                [$resourcelinkid, $userid],
                $fields
            );
        }
        if ($row) {
            $user->setRecordId($row->id);
            $user->setResourceLinkId($row->resourcelinkid);
            $user->ltiUserId = $row->ltiuserkey;
            $user->ltiResultSourcedId = $row->ltiresultsourcedid;
            $user->created = $row->created;
            $user->updated = $row->updated;
            return true;
        }

        return false;
    }
58946
public function login($username = '', $password = '', $remember = false)
    {
        $db = $this->getDb();
        $table = $this->getTables();
        list($userColumnName, $passColumnName) = $table['login'];
        $getTables = $table['select'];

        $getTables[] = $table['authentication']['column'];

        $db->where([
            [$userColumnName, $username],
            [$passColumnName, $password]
        ]);

        if ($db->exists()) {
            $login = $db->first();

            // we will find user ip address
            // and add it to login information
            $ip = Security::ip();


            $login['ip'] = $ip;
            $login = new LoginObject($login);

            $this->getSession()->set(static::USER_SESSION, $login);
            if ($remember) {
                $this->getCookie()->set(static::USER_SESSION, serialize($login));
            }

            $add = $db->insert([
                'ip' => $ip,
                'username' => $username
            ]);

            if ($add->isSuccess()) {
                return $login;
            }
        }

        return false;


    }
296763
public static function login($username, $password) {
		if ($user = user::find($username, $password)) {
			self::$user           = $user;
			self::$isGuest        = false;
			$_SESSION["username"] = $username;

			return true;
		}

		return false;
	}
245006
public function setUser($user)
    {
        if ($user instanceof User) {
            $this->_user = $user;
            return true;
        }
        $this->_user = null;
        return false;
    }
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;
	}
822652
public function loginUsingId($id, $remember = false)
    {
        $this->session->put($this->getName(), $id);

        $user = $this->provider->retrieveById($id);

        $this->login($user, $remember);

        return $user;
    }