Update the password for a current user

@param string $newPassword
@return boolean
768152
public function updatePassword(string $currentPassword, string $newPassword, string $verifyPassword) : bool
    {
        // Get the current password
        $currentPassword = trim($currentPassword);

        // First off check that the current password matches the current password
        if (password_verify($currentPassword, $this->password)) {
            // Get the new password and the verify
            $newPassword = trim($newPassword);
            $verifyPassword = trim($verifyPassword);

            $data = [
                'new_password' => $newPassword,
                'verify_password' => $verifyPassword,
            ];

            //Ok let validate user password
            $validation = new Validation();
            $validation->add('new_password', new PresenceOf(['message' => 'The password is required.']));

            $validation->add(
                'new_password',
                new StringLength([
                    'min' => 8,
                    'messageMinimum' => 'Password is too short. Minimum 8 characters.',
                ])
            );

            $validation->add('new_password', new Confirmation([
                'message' => 'New password and confirmation do not match.',
                'with' => 'verify_password',
            ]));

            //validate this form for password
            $messages = $validation->validate($data);
            if (count($messages)) {
                foreach ($messages as $message) {
                    throw new Exception($message);
                }
            }

            // Check that they are the same
            if ($newPassword === $verifyPassword) {
                // Has the password and set it
                $this->password = self::passwordHash($newPassword);

                return true;
            } else {
                throw new Exception(_('New password and confirmation don\'t match . '));
            }
        }

        throw new Exception(_(' Your current password is incorrect .'));
    }
1265374
static public function password( $userID, $newPassword )
    {
        $user = eZUser::fetch( $userID );

        if ( $user instanceof eZUser )
        {
            $login   = $user->attribute( 'login' );
            $type    = eZUser::hashType();
            $site    = $user->site();
            $newHash = $user->createHash( $login, $newPassword, $site, $type );
            $user->setAttribute( 'password_hash', $newHash );
            $user->setAttribute( 'password_hash_type', $type );
            $user->store();

            // "Draft" must be in sync with the PersistentObject
            self::updateUserDraft( $user );
			
            eZContentCacheManager::clearContentCacheIfNeeded( $userID );

            return array( 'status' => true );
        }
        else
        {
            eZDebug::writeError( "Failed to change password of user $userID (could not fetch user)", __METHOD__ );
            return array( 'status' => false );
        }
    }
751905
public function changePassword($password)
    {
        $this->password = $password;

        $this->raise(new PasswordChanged($this));

        return $this;
    }
877336
public function modifyPassword($newPassword)
    {
        $url = Config::get('url.password_modify');

        $param['__VIEWSTATE'] = true;
        $param['TextBox2'] = $this->login->getPassword();
        $param['TextBox3'] = $newPassword;
        $param['Textbox4'] = $newPassword;
        $param['Button1'] = '修  改';

        $response = $this->request('post', [$url, $param]);

        $body = $this->checkAndThrow($response);

        // Convert the data charset from gb2312 to utf-8
        $content = mb_convert_encoding($body, "utf-8", "gb2312");

        // Check whether success
        if (preg_match('/<script.*>alert\(\'(.*)\'\).*<\/script>/', $content, $matches)) {
            if ($matches[1] == "修改成功！") {
                return true;
            }
            throw new HttpException($matches[1], 10006);
        }

        throw new HttpException('修改密码失败', 10007);
    }
1366716
public function setPassword(string $newPassword): void
    {
        //hash provided password
        $this->password = $this->passwordUtility->hash($newPassword);
    }
798820
public function updateUserWithoutCurrentPassword($userLogin, $password = false, $email = false, $alias = false,
                                                     $_isPasswordHashed = false)
    {
        API::$UPDATE_USER_REQUIRE_PASSWORD_CONFIRMATION = false;
        try {
            Request::processRequest('UsersManager.updateUser', [
                'userLogin' => $userLogin,
                'password' => $password,
                'email' => $email,
                'alias' => $alias,
                '_isPasswordHashed' => $_isPasswordHashed,
            ], $default = []);
            API::$UPDATE_USER_REQUIRE_PASSWORD_CONFIRMATION = true;
        } catch (\Exception $e) {
            API::$UPDATE_USER_REQUIRE_PASSWORD_CONFIRMATION = true;
            throw $e;
        }
    }
1083907
public function setPassword($password)
    {
        if (mb_strlen($password) == 0) {
            $this->throwError('Password not set');
        }

        $this->password = $password;

        return $this;
    }
218
public function changePassword()
    {
        if ($this->validate()) {
            if (!($user = $this->getUser())) {
                return false;
            }
            if (!$user->applyForNewPassword()) {
                return false;
            }
            return $user->resetPassword($this->new_password, $user->getPasswordResetToken());
        }
        return false;
    }
321758
public function passwordChange($newPassword) {
        if ($this->locked) {
            throw new BlocktrailSDKException("Wallet needs to be unlocked to change password");
        }

        if (!$this->secret) {
            throw new BlocktrailSDKException("No secret");
        }

        $encryptedSecret = CryptoJSAES::encrypt($this->secret, $newPassword);

        $this->sdk->updateWallet($this->identifier, ['encrypted_secret' => $encryptedSecret]);

        $this->encryptedSecret = $encryptedSecret;

        return [
            'encrypted_secret' => MnemonicFactory::bip39()->entropyToMnemonic(new Buffer(base64_decode($this->encryptedSecret))),
        ];
    }
873953
public function resetPassword()
    {
        $user = $this->_user;
        $user->new_password = $this->password;
        $user->removePasswordResetToken();

        return $user->save(false);
    }
78100
public static function changePasswordByCodeWithUsername($username, $code, $newPassword, $login)
    {
        return static::changePasswordByCode(static::getEmailByUsername($username), $code, $newPassword, $login);
    }
951338
public function setPassword($password)
    {
        $this->validateSecureConnection();

        $encodedPassword = Utilities::encodePassword($password);

        if ($this->exists) {
            // If the record exists, we need to add a batch replace
            // modification, otherwise we'll receive a "type or
            // value" exists exception from our LDAP server.
            return $this->addModification(
                $this->newBatchModification(
                    $this->schema->unicodePassword(),
                    LDAP_MODIFY_BATCH_REPLACE,
                    [$encodedPassword]
                )
            );
        } else {
            // Otherwise, we are creating a new record
            // and we can set the attribute normally.
            return $this->setFirstAttribute(
                $this->schema->unicodePassword(),
                $encodedPassword
            );
        }
    }
921527
public function updatePassword($username, $password)
    {
        $parameters['username'] = $username;
        $parameters['password'] = $password;
        return $this->apiClient->callEndpoint(
            sprintf('%s/avatars', self::ENDPOINT),
            $parameters,
            null,
            HttpMethod::REQUEST_PUT
        );
    }
212766
function changeAuthPassword($user, $password, $multicall = false)
    {
        if (!is_string($user) || !isset(self::$levels[$user])) {
            throw new InvalidArgumentException('user = ' . print_r($user, true));
        }
        if (!is_string($password)) {
            throw new InvalidArgumentException('password = ' . print_r($password, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($user, $password), $multicall);
    }
911750
public function changeUserPassword($uid, $newPassword): UserRecord
    {
        return $this->updateUser($uid, Request\UpdateUser::new()->withClearTextPassword($newPassword));
    }
893240
protected static function changePasswordBySecurityAnswerWithUsername($username, $answer, $newPassword, $login)
    {
        return static::changePasswordBySecurityAnswer(
            static::getEmailByUsername($username),
            $answer,
            $newPassword,
            $login
        );
    }
1023659
public function changePassword()
    {
        if ($this->validate() && $this->new_password == $this->new_password_confirm && $this->new_password) {
            $this->user->setPassword($this->new_password);
            return $this->user->save(false);
        } else {
            return false;
        }
    }