Validates a database password
@return boolean|null
505738
protected function validateDbPasswordInstall()
    {
        $field = 'database.password';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if (!isset($value)) {
            $this->setSubmitted($field, '');
            return null;
        }

        return true;
    }
264110
public function checkPassword(string $password): bool
    {
        $password_hash = DB::table('user')
            ->where('user_id', '=', $this->id())
            ->value('password');

        if ($password_hash !== null && password_verify($password, $password_hash)) {
            if (password_needs_rehash($password_hash, PASSWORD_DEFAULT)) {
                $this->setPassword($password);
            }

            return true;
        }

        return false;
    }
667785
public function validate()
    {
        $steps = [
            'PrivateKey',
            'IdpMetadata',
            'SpMetadata'
        ];

        foreach ($steps as $step) {
            $method = 'validate' . $step;
            if (!$this->$method()) {
                return false;
            }
        }

        return true;
    }
503356
public function validate(array $creds = []) : bool {
      $user = '';
      $pass = '';

      //Check for user keys
      foreach (self::USER_KEYS as $key) {
          if (isset($creds[$key])) {
              $user = $creds[$key];
          }
      }

      //Check for password keys
      foreach (self::PASSWORD_KEYS as $key) {
          if (isset($creds[$key])) {
              $pass = $creds[$key];
          }
      }

      $decrypted = Assist::hash(Assist::decrypt($this->password));

      if ($this->username === $user && $decrypted === $pass) {
          return true;
      }

      return false;
  }
1182398
protected function databaseSetupPassword()
    {
        $pass        = $this->secret('Please enter the database password');
        $passConfirm = $this->secret('Please confirm the database password');

        if ($pass != $passConfirm) {
            $this->error('[ERROR] Database passwords do not match. Please retry.');
            $this->databaseSetupPassword();
        }

        return $pass;
    }
1247061
public function validatePassword()
    {
        /* @var $user User */
        $user = Yii::$app->user->identity;
        if (!$user || !$user->validatePassword($this->oldPassword)) {
            $this->addError('oldPassword', 'Incorrect old password.');
        }
    }
304967
private function validateIban(): bool
    {
        $value = \substr($this->value, 4).\substr($this->value, 0, 4);
        $value = \str_replace(
            ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
                'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
            ['10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22',
                '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35'],
            $value
        );

        $tmp = \intval(\substr($value, 0, 1));
        $len = \strlen($value);
        for ($i = 1; $i < $len; ++$i) {
            $tmp *= 10;
            $tmp += \intval(\substr($value, $i, 1));
            $tmp %= 97;
        }
        $valid = $tmp == 1 ? true : false;
        if (!$valid) {
            $this->setError(self::VALIDATOR_ERROR_IBAN_INVALID_NUMBER);
        }
        return $valid;
    }
774270
public function validatePassword($password)
    {
        if (static::judgePasswordHash($password)) {
            return $this->{$this->passwordHashAttribute} == $password;
        }
        return Yii::$app->security->validatePassword($password, $this->{$this->passwordHashAttribute});
    }
1245028
protected function getMaximumRequirement()
    {
        $maximumLength = $this->config->get('concrete.user.password.maximum');

        return $maximumLength ? $this->app->make(MaximumLengthValidator::class, [$maximumLength]) : null;
    }
328725
public function validatePassword(string $password): bool
    {
        $this->A1 = md5($this->digestParts['username'].':'.$this->realm.':'.$password);

        return $this->validate();
    }
804899
public function validate_user($username_or_email = '', $password = '')
	{
		$username_or_email = trim($username_or_email) ?: trim(\Input::post(\Config::get('simpleauth.username_post_key', 'username')));
		$password = trim($password) ?: trim(\Input::post(\Config::get('simpleauth.password_post_key', 'password')));

		if (empty($username_or_email) or empty($password))
		{
			return false;
		}

		$password = $this->hash_password($password);
		$user = \DB::select_array(\Config::get('simpleauth.table_columns', array('*')))
			->where_open()
			->where('username', '=', $username_or_email)
			->or_where('email', '=', $username_or_email)
			->where_close()
			->where('password', '=', $password)
			->from(\Config::get('simpleauth.table_name'))
			->execute(\Config::get('simpleauth.db_connection'))->current();

		return $user ?: false;
	}
895602
public function doDatabaseCheck()
    {
        $validator = new Validation\Database();
        $validator->setPathResolver($this->config->app['path_resolver']);
        $validator->setConfig($this->config->app['config']);
        $validator->check();
    }
493546
protected function validate()
    {
        // If attributes are set, validate them.
        if (!empty($this->attributes)) {
            // It's possible that there are no rules for the attributes available.
            // If so, skip attribute validation.
            if (sizeof($this->getAttributeRules()) > 0) {
                $validate_attributes = new Validator($this->attributes);
                $validate_attributes->rules($this->getAttributeRules());

                // Validation failed to succeeed, show errors
                if (!$validate_attributes->validate()) {
                    echo 'Some attributes failed to pass the validator:';
                    foreach ($validate_attributes->errors() as $failed_attr) {
                        echo ' '. $failed_attr[0];
                    }
                    return false;
                }
            }
        }

        // If a value is set, validate it.
        if (array_key_exists('value', $this)) {
            // It's possible that there is no value rule set.
            // If so, skip value validation.
            if (sizeof($this->getValueRule()) > 0) {
                $validate_value = new Validator(['value' => $this->value]);
                $validate_value->rules($this->getValueRule());

                // Validation failed to succeeed, show errors
                if (!$validate_value->validate()) {
                    echo "The 'value' failed to pass the validator:";
                    foreach ($validate_value->errors() as $message) {
                        if (is_array($message)) {
                            $message = implode(',', $message);
                        }
                        echo ' '. strtolower($message);
                    }
                    return false;
                }
            }
        }

        return true;
    }
768687
protected function validateDbTypeInstall()
    {
        $field = 'database.type';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if (empty($value)) {
            $this->setErrorRequired($field, $this->translation->text('Database type'));
            return false;
        }

        $drivers = \PDO::getAvailableDrivers();

        if (in_array($value, $drivers)) {
            return true;
        }

        $error = $this->translation->text('Unsupported database driver. Available drivers: @list', array(
            '@list' => implode(',', $drivers)));

        $this->setError($field, $error);
        return false;
    }
834439
public function valid()
    {

        if ($this->container['loggedAt'] === null) {
            return false;
        }
        if ($this->container['containerId'] === null) {
            return false;
        }
        if ($this->container['containerTypeId'] === null) {
            return false;
        }
        if ($this->container['characterId'] === null) {
            return false;
        }
        if ($this->container['locationId'] === null) {
            return false;
        }
        if ($this->container['locationFlag'] === null) {
            return false;
        }
        $allowedValues = $this->getLocationFlagAllowableValues();
        if (!in_array($this->container['locationFlag'], $allowedValues)) {
            return false;
        }
        if ($this->container['action'] === null) {
            return false;
        }
        $allowedValues = $this->getActionAllowableValues();
        if (!in_array($this->container['action'], $allowedValues)) {
            return false;
        }
        $allowedValues = $this->getPasswordTypeAllowableValues();
        if (!in_array($this->container['passwordType'], $allowedValues)) {
            return false;
        }
        return true;
    }
143324
public function check()
    {
        $result = true;

        // TODO This check tries only to connect to the database
        // But it would make sense to check
        //  a) insert, select, update, delete, etc. access
        //  a) a) Which access rights do i need? Topic hardening?
        try {
            $this->database->connect($this->database->getConfig());
        } catch (\Exception $e) {
            $result = false;
        }

        return $result;
    }
905037
protected function validateFile()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->file->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('File'));
            return false;
        }

        $this->setSubmitted('update', $data);
        return true;
    }