Log in the user based on specified fields.

@param array $pFields Associative array of fields to check
@return bool
555014
public function login(array $pFields)
	{
		$this->logout();

		$conditions = new Conditions();
		foreach ($pFields as $field => $value) {
			$conditions->add($field, Conditions::EQ, $value);
		}

		$this->_user->load(array(
			DbInterface::FILTER_CONDITIONS => $conditions
		));
		if ($this->_user->getId()) {
			$this->_session->userId = $this->_user->getId();
			return true;
		}

		return false;
    }
208063
private function isValidFields(array $fields): void
    {
        $allowedFields = $this->getAllowedFields();
        foreach ($fields as $field) {
            if (!\in_array($field, $allowedFields, true)) {
                throw new InvalidKeyException(sprintf(
                    '%s is not a valid value. fields must only contain "%s".',
                    $field,
                    implode(', ', $allowedFields)
                ));
            }
        }
    }
416404
public function loginWith(TableNode $fields) {
    $user = [
      "first_name" => $this->faker->firstName,
      "last_name" => $this->faker->lastName,
      "email" => $this->faker->email,
      "password" => $this->faker->password,
      "groups" => ""
    ];
    foreach ($fields->getRowsHash() as $field => $value) {
      $user[$field] = $value;
    }
    $user["groups"] .= (empty($user["groups"]) ? "" : ",") . "user";
    $this->models->get("users")->store($user);
    $this->login($user);
  }
927183
public function validateAsRequiredFields(array $fields) {
		foreach ($fields as $v) {
			$options = $this->fields[$v];
			$options['options']['required'] = true;
			$this->validateRequiredOneField($this->values[$v], $v, $options);
		}
	}
1270232
protected function fields(array $fields) {
        if (!empty($fields)) {
            if (!is_numeric(key($fields))) {
                $fields = array_keys($fields);
            }
            $this->insertFields = $fields;
        }
        return $this;
    }
908067
public function getUserField($field = null, $userInfo = null) {
		if (empty($field)) {
			return null;
		}

		if (!empty($userInfo) && is_array($userInfo)) {
			$targetUserInfo = $userInfo;
		} else {
			$targetUserInfo = $this->_userInfo;
		}

		if (empty($targetUserInfo) || !is_array($targetUserInfo)) {
			return null;
		}

		$result = Hash::get($targetUserInfo, $field);

		return $result;
	}
263178
public function insert($fields)
    {
        // Set fields
        $this->fields($fields);

        // Define fields
        $fields = $this->getInsertFieldsString();

        // Build query
        $this->query = 'INSERT INTO ' . $this->table . $fields;

        // Prepare statement
        $this->statement = $this->pdo->prepare($this->query);

        // Bind fields values
        $this->bindFields();

        // Execute statement
        $result = $this->statement->execute();

        // Reset values
        $this->reset();

        // Return result
        return $result;
    }
1318081
public function addFields(array $fields)
    {
        $oldFields = $this->_queryBuilder->getFields() ? $this->_queryBuilder->getFields() : array();
        $newFields = array_merge($oldFields, $fields);
        $this->setFields($newFields);
        return $this;
    }
892087
private function _getPreparedFields(array $pFields)
    {
        $fields = array();
        $keys   = array_keys($pFields);
        foreach ($keys as $key) {
            $fields[] = "`$key` = ?";
        }

        return implode(', ', $fields);
    }
1099752
public function basic($field = 'email', $extraConditions = [])
    {
        if ($this->check()) {
            return;
        }

        // If a username is set on the HTTP basic request, we will return out without
        // interrupting the request lifecycle. Otherwise, we'll need to generate a
        // request indicating that the given credentials were invalid for login.
        if ($this->attemptBasic($this->getRequest(), $field, $extraConditions)) {
            return;
        }

        return $this->failedBasicResponse();
    }
56567
public function fillKeyField(array &$fields)
    {
        $model   = $this->config->getDataModel();
        $keyName = $model->getKeyName();

        //add the primary key field, which will be uneditable, but part of the data model
        if ($this->config->getType() === 'model' && !isset($fields[$keyName])) {
            $keyField         = $this->make($keyName, array('visible' => false));
            $fields[$keyName] = $keyField->getOptions();
        }
    }
592066
public function fields(array $fields = null) {
        if ($fields === null) {
            return $this->fields;
        }

        $this->fields = $fields;

        return $this;
    }
1177809
public function setField($pField, $pDistinct = false)
    {
        Agl::validateParams(array(
            'String' => $pField,
            'Bool'         => $pDistinct
        ));

        $this->_field = array(
            static::FIELD_NAME     => $pField,
            static::FIELD_DISTINCT => $pDistinct
        );
        return $this;
    }
1274045
function getProfile(array $fields = array())
    {
        $params = array(1, $this->username, $this->password);
        if (!empty($fields)) {
            $params[] = $fields;
        }

        return $this->sendRequest('wp.getProfile', $params);
    }
1278102
public function getUserField($field)
    {
        //$cache = self::getCacheFactory();
        //return unserialize($cache->load($this->getFieldCacheKey($field)));

        if (isset(self::$cachedFields[$this->ID][$field])) {
            return self::$cachedFields[$this->ID][$field];
        } elseif ($userField = $this->Fields()->find('Name', $field)) {
            return self::$cachedFields[$this->ID][$field] = (string)$userField->getField('Value');
        }

        return null;
    }
493121
public function deleteFields(array $fields)
    {
        $fields = Validate::arrToLower($fields);
        if (($key = array_search($this->databaseConfig->getIdentifier(), $fields)) !== false)
            throw new \Exception('You can not delete the id field');
        $diff   = array_diff($fields,$this->fields());
        if (!empty($diff))
            throw new \Exception('Field(s) "' . implode(', ', $diff) . '" does not exists in table');
        $config         = $this->getConfig();
        $config->schema = array_diff_key($this->schema(), array_flip($fields));
        $data = $this->getData();
        foreach ($data as $key => $object)
        {
            foreach ($fields as $name)
                unset($data[$key]->{$name});
        }
        $this->databaseDocument->put($data);
        $this->databaseConfig->put($config);
        return true;
    }
1316396
public function useFields($fields)
    {
        if (is_string($fields)) {
            $fields = explode(',', $fields);
        }
        $this->fields = $fields;

        return $this;
    }