Changes password.
@return bool
979810
public function changePassword()
    {
        $this->setPassword($this->password);
        $this->generateAuthKey();
        $this->removePasswordResetToken();
        return $this->save();
    }
969301
public void changePassword() {

        final String oldPassword = m_oldPassword.getFormValueAsString();
        final String newPassword1 = m_newPassword1.getFormValueAsString();
        final String newPassword2 = m_newPassword2.getFormValueAsString();

        CmsRpcAction<String> action = new CmsRpcAction<String>() {

            @Override
            public void execute() {

                start(0, true);
                CmsCoreProvider.getService().changePassword(oldPassword, newPassword1, newPassword2, this);
            }

            @Override
            public void onResponse(String result) {

                stop(false);
                if (result == null) {
                    m_finishAction.run();
                } else {
                    showError(result);
                }
            }
        };
        action.execute();
    }
1054612
public function resetPassword()
    {
        $user = $this->user;
        $user->setPassword($this->password);
        $user->removePasswordResetToken();

        return $user->save();
    }
266835
public function saveNewPassword(string $password, bool $reset_token = false): bool
    {
        $this->setPassword($password);
        if ($reset_token === true) {
            $this->removePasswordResetToken();
        }
        return $this->save();
    }
1335897
public function actionChangePassword()
    {
        $model = $this->model;

        $modelForm = new PasswordChangeForm([
            'user' => $model
        ]);

        if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
            $modelForm->load(\Yii::$app->request->post());
            \Yii::$app->response->format = Response::FORMAT_JSON;
            return \skeeks\cms\modules\admin\widgets\ActiveForm::validate($modelForm);
        }


        if ($modelForm->load(\Yii::$app->request->post()) && $modelForm->changePassword()) {
            \Yii::$app->getSession()->setFlash('success', 'Успешно сохранено');
            return $this->redirect(['change-password', 'id' => $model->id]);
        } else {
            if (\Yii::$app->request->isPost) {
                \Yii::$app->getSession()->setFlash('error', 'Не удалось изменить пароль');
            }

            return $this->render('@skeeks/cms/views/admin-user/change-password.php', [
                'model' => $modelForm
            ]);

            /*return $this->render('_form-change-password', [
                'model' => $modelForm,
            ]);*/
        }
    }
744405
static function changePassword(\Db\Connection $db, User $user, $password) {
    self::deletePasswords($db, $user);
    return self::addPassword($db, $user, $password);
  }
177757
private function resetPasswordEncryption()
    {
        $defaultEncryption = Security::config()->get('password_encryption_algorithm');
        if ($this->owner->PasswordEncryption != $defaultEncryption) {
            DB::prepared_query(
                'UPDATE "Member" SET "PasswordEncryption" = ? WHERE ID = ?',
                [$defaultEncryption, $this->owner->ID]
            );
        }
    }
132592
final protected function _canChangePassword() {
         //validate that required indices exist
        if (!isset($this->_userProfile['username'])
            || !isset($this->_userProfile['password'])
            || !isset($this->_userProfile['fullname'])
            || !isset($this->_userProfile['passhist'])
        ) {
            throw new UserCredentialException('The username and password are not set', 1016);
        }
  
        //Verify if the password was changed today or server has been futuredated
        $currDateTimeObj = new \DateTime();
        
        //Password was changed today or in the future
        if ($currDateTimeObj <= $this->_userProfile['policyinfo']['password_last_changed_datetime']) {
            return false;
        } else {
            return true;
        }
    }
525244
public function changePassword($options = []) {
		$options = Hash::merge($this->getConfig('changePassword'), $options);

		$entity = $this->UserTable->newEntity();
		$entity->accessible([
			'old_password',
			'password',
			'new_password',
			'confirm_password'
		], true);

		if ($this->_getRequest()->is(['post', 'put'])) {
			$entity = $this->UserTable->get($this->_getAuthObject()->user('id'));
			$entity = $this->UserTable->patchEntity($entity, $this->_getRequest()->data, [
				'validate' => 'changePassword'
			]);

			if ($this->UserTable->changePassword($entity)) {
				$this->_getRequest()->data = [];
				$entity = $this->UserTable->newEntity();
				$this->handleFlashAndRedirect('success', $options);
			} else {
				$this->handleFlashAndRedirect('error', $options);
			}
		}

		$this->_setViewVar('entity', $entity);
	}
477583
public function setPassword($password){
        if(!$this->setModified('password', $password)->isModified()){
            return $this;
        }
        $this->password = $password;
        $this->passwordChanged = true;
        return $this;
    }
358355
public static function changePassword($username , $new_password)
	{
		self::setUser( $username , $new_password );
		self::log( 'changepwd' , $username );
		self::save();

		return true;
	}
853256
public function changePassword($username, $newPass)
    {
        $password = $this->hasher->HashPassword($newPass);
        return $this
            ->conn
            ->prepare(sprintf("UPDATE %s SET user_pass=:newPass WHERE user_name = :username", $this->table))
            ->execute(['newPass' => $password, 'username' => $username]);
    }
34963
def change_password(self, old_password, new_password):
		""""""
		body = self._formdata({
			"old_password": old_password,
			"password": new_password,
		}, ["old_password", "password"])
		content = self._fetch("/current_user/password", method="POST", body=body)
		return FastlyUser(self, content)
1157143
public function password()
    {
        $this->setData('formTitle', __("Change password"));
        if ($this->getServiceLocator()->get(ApplicationService::SERVICE_ID)->isDemo()) {
            $this->setData('myForm', __('Unable to change passwords in demo mode'));
        } else {
            $myFormContainer = new tao_actions_form_UserPassword();
            $myForm = $myFormContainer->getForm();
            if($myForm->isSubmited()){
                if($myForm->isValid()){
                    $user = $this->getUserService()->getCurrentUser();
                    $this->getServiceLocator()->get(tao_models_classes_UserService::SERVICE_ID)
                        ->setPassword($user, $myForm->getValue('newpassword'));
                    $this->setData('message', __('Password changed'));
                }
            }
            $this->setData('myForm', $myForm->render());
        }

        $this->setView('form/settings_user.tpl');
    }
1073043
protected function redirectToChangePassword()
    {
        $cp = ChangePasswordForm::create($this, 'ChangePasswordForm');
        $cp->sessionMessage(
            _t('SilverStripe\\Security\\Member.PASSWORDEXPIRED', 'Your password has expired. Please choose a new one.'),
            'good'
        );
        $changedPasswordLink = Security::singleton()->Link('changepassword');

        return $this->redirect($this->addBackURLParam($changedPasswordLink));
    }
749955
public function actionResetPassword()
    {
        /** @var User $user */
        $user = null;
        
        while (empty($user)) {
            $email = $this->email ?: $this->prompt('User E-Mail:');
            $user = User::findByEmail($email);
            if (empty($user)) {
                $this->outputError('The provided E-Mail not found in the System.');
            }
        }
    
        $password = $this->password ?: $this->prompt('User Password:');
    
        if ($this->confirm("Are you sure to change the password of User '$email'?") !== true) {
            return $this->outputError('Abort password change process.');
        }
        
        $user->password_salt = Yii::$app->getSecurity()->generateRandomString();
        $user->password = Yii::$app->getSecurity()->generatePasswordHash($password.$user->password_salt);
        if ($user->save(true, ['password', 'password_salt'])) {
            return $this->outputSuccess("The password for user ($email) has been changed.");
        }
    
        return $this->outputError("The password could not changed.\n" . implode("\n", $user->firstErrors));
    }
688222
public function changeUsername()
    {
        if ($this->validate()) {
            $username = $this->user->createUsername($this->username);
            if (!$username) {
                return false;
            }
            return $username->save();
        }
        return false;
    }