Get password

If no "password" value has been set, this method will
set and return a default "password" value,
if any such value is available

@see getDefaultPassword()

@return string|null password or null if no password has been set
348081
public function getPassword() : ?string 
    {
        if ( ! $this->hasPassword()) {
            $this->setPassword($this->getDefaultPassword());
        }
        return $this->password;
    }
289343
protected function validatePasswordOldUser()
    {
        $field = 'password_old';

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

        if (!$this->isUpdating() || !empty($this->options['admin'])) {
            return null;
        }

        $password = $this->getSubmitted('password');

        if (!isset($password) || $password === '') {
            return null;
        }

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

        if (!isset($old_password) || $old_password === '') {
            $this->setErrorRequired($field, $this->translation->text('Old password'));
            return false;
        }

        $updating = $this->getUpdating();
        $hash = gplcart_string_hash($old_password, $updating['hash'], 0);

        if (!gplcart_string_equals($updating['hash'], $hash)) {
            $error = $this->translation->text('Old and new password not matching');
            $this->setError($field, $error);
            return false;
        }

        return true;
    }
396647
public function getValue()
    {
        $from_input = $this
            ->grid
            ->getInputProcessor()
            ->getFilterValue($this->config->getId());
        if ($from_input === null) {
            return $this->config->getDefaultValue();
        } else {
            return $from_input;
        }
    }
401442
private function getPassword()
    {
        $password = $this->secret("Enter your password");
        $passwordAgain = $this->secret("Enter your password again");

        $validator = Validator::make([
            'password'              => $password,
            'password_confirmation' => $passwordAgain,
        ], [
            'password' => 'required|min:5|confirmed',
        ]);

        if( $validator->fails() ) {
            $this->info('');
            $this->error("The password must be at least 5 characters and must match!");
            $this->info('');

            return $this->getPassword();
        }

        $this->password = bcrypt($password);
    }
930746
public function defaultValue()
    {
        if ($this->default === null) {
            return null;
        }

        $default = $this->default;

        if (strstr($this->default, '{{') && strstr($this->default, '}}')) {
            // Parse special replacements (if we have one)
            $default = str_replace("{{CURRENT_TIME}}", date('c', time()), $default);
        }

        return $default;
    }
226449
protected function initDefault()
    {
        if ($this->isCli()) {
            return null;
        }

        $uri = (empty($_SERVER['HTTPS']) ? 'http' : 'https')
            . '://'
            . $_SERVER['HTTP_HOST']
            . $_SERVER['REQUEST_URI'];
        return  rtrim(preg_replace('/\?.*/', '', $uri), '/');
    }
976156
public function getValue()
    {
        $value = $this->getModelValue();
        if (is_null($value)) {
            $value = $this->getDefaultValue();
        }

        return $value;
    }
391182
protected function askForNewPassword()
    {
        $this->password = $this->ask('What would you like to set the password to?');

        $q = $this->ask('Confirm the password as "' . $this->password . '" [y/n]');

        if (strtolower($q) != 'y') {
            return $this->askForNewPassword();
        }
    }
993954
public function getDefaultTitle()
    {
        if (empty($this->title_default)) {
            return $this->config->get('defaults.title', null);
        }

        return $this->title_default;
    }
136344
public function getValue() {
        if (!is_null($this->value))
            return $this->value;
        $value = $this->getArrayValue($this->form->method == 'POST' ? $_POST : $_GET, $this->getName());
        if ($value) {
            return $value;
        }
        $key = null;
        if (false !== strpos($this->name, '[')){
            $name = explode('[', $this->name, 2);
            $key = substr($name[1], 0, strlen($name[1]) - 1);
            $name = $name[0];
        } else {
            $name = $this->name;
        }
        if ($this->form->model && is_object($this->form->model) && (!$this->form->model->isNewRecord() || $this->form->model->$name)) {
            $val = $this->form->model->$name;
            if (!is_null($key)){
                return isset($val[$key])?$val[$key]:null;
            } else {
                return $val;
            }
        }
        return $this->defaultValue;
    }
182024
public function passwordForgot()
    {
        //Checks if reset password is enabled
        if (!getConfig('users.reset_password')) {
            $this->Flash->error(I18N_DISABLED);

            return $this->redirect(['_name' => 'homepage']);
        }

        $entity = $this->Users->newEntity($this->request->getData(), ['validate' => 'DoNotRequirePresence']);

        if ($this->request->is('post')) {
            //Checks for reCAPTCHA, if requested
            if (!getConfig('security.recaptcha') || $this->Recaptcha->verify()) {
                $user = $this->Users->findActiveByEmail($this->request->getData('email'))->first();

                if ($user) {
                    $token = $this->Token->create($user->email, ['type' => 'password_forgot', 'user_id' => $user->id]);
                    $this->getMailer('MeCms.User')
                        ->set('url', Router::url(['_name' => 'passwordReset', $user->id, $token], true))
                        ->send('passwordForgot', [$user]);
                    $this->Flash->success(__d('me_cms', 'We have sent you an email to reset your password'));

                    return $this->redirect(['_name' => 'login']);
                }

                if ($this->request->getData('email')) {
                    Log::error(sprintf(
                        '%s - Forgot password request with invalid email `%s`',
                        $this->request->clientIp(),
                        $this->request->getData('email')
                    ), 'users');
                }

                $this->Flash->error(__d('me_cms', 'No account found'));
            } else {
                $this->Flash->error(__d('me_cms', 'You must fill in the {0} control correctly', 'reCAPTCHA'));
            }
        }

        $this->set('user', $entity);
        $this->viewBuilder()->setLayout('login');
    }
318038
public function getDefault()
    {
        if ($this->default) {
            return $this->default;
        }
        if (!empty($this->values)) {
            return reset($this->values);
        }
        return null;
    }
995297
public String getPassword()
    {
    	if ((password != null) && (password.length() > 0))
    		return password;	// External override
        char[] rgchPassword = passwordField.getPassword();
        return new String(rgchPassword);
    }
1274205
public function userPassword($password = null)
    {
        if ($password === null) {
            return $this->_userPassword;
        }
        $this->_userPassword = $password;

        return $this;
    }
1181224
protected function validatePasswordLengthUser()
    {
        $field = 'password';

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

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

        if ($this->isUpdating() && (!isset($value) || $value === '')) {
            return null;
        }

        $length = mb_strlen($value);
        list($min, $max) = $this->user->getPasswordLength();

        if ($length < $min || $length > $max) {
            $this->setErrorLengthRange($field, $this->translation->text('Password'), $min, $max);
            return false;
        }

        return true;
    }
1334928
public function getKey() : ?string 
    {
        if ( ! $this->hasKey()) {
            $this->setKey($this->getDefaultKey());
        }
        return $this->key;
    }
1088299
private function getPassword(): ? string
    {
        $password = $this->secret("Enter your password");
        $passwordAgain = $this->secret("Enter your password again");

        $validator = Validator::make([
            'password' => $password,
            'password_confirmation' => $passwordAgain,
        ], [
            'password' => 'required|min:6|confirmed',
        ]);

        if ($validator->fails()) {
            $this->info('');
            $this->error("The password must be at least 5 characters and must match!");
            $this->info('');

            return $this->getPassword();
        }

        $this->password = $password;

        return null;
    }