Changes the password for the given user to the new password

@param userName
@param newPassword
@return <code>true</code> if the password was successfully changed.
762809
public static boolean changePassword(String userName, String newPassword) {
        LOGGER.entering(userName, newPassword.replaceAll(".", "*"));
        boolean changeSucceeded = false;
        File authFile = new File(AUTH_FILE_LOCATION);
        try {
            authFile.delete();
            authFile.createNewFile();
            createAuthFile(authFile, userName, newPassword);
            changeSucceeded = true;
        } catch (Exception e) {
            changeSucceeded = false;
        }
        LOGGER.exiting(changeSucceeded);
        return changeSucceeded;
    }
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;
        }
    }
977386
def change_password(self, new_password):
        
        self.set_password(new_password)
        self.save()
        password_changed.send(sender=self.__class__, user=self)
893240
protected static function changePasswordBySecurityAnswerWithUsername($username, $answer, $newPassword, $login)
    {
        return static::changePasswordBySecurityAnswer(
            static::getEmailByUsername($username),
            $answer,
            $newPassword,
            $login
        );
    }
358415
public final boolean resetPassword(String token, String newpass) {
		if (StringUtils.isBlank(newpass) || StringUtils.isBlank(token) || newpass.length() < Config.MIN_PASS_LENGTH) {
			return false;
		}
		Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier);
		if (isValidToken(s, Config._RESET_TOKEN, token)) {
			s.removeProperty(Config._RESET_TOKEN);
			String hashed = Utils.bcrypt(newpass);
			s.addProperty(Config._PASSWORD, hashed);
			setPassword(hashed);
			CoreUtils.getInstance().getDao().update(getAppid(), s);
			return true;
		}
		return false;
	}
272018
@POST
  @Path("{id}/password")
  @PermitAll
  public Response changePassword(@PathParam("id") Long userId, PasswordRequest request) {
    checkNotNull(userId);
    checkNotNull(request.getToken());
    checkPasswordFormat(request.getNewPassword());

    boolean isSuccess = userService.confirmResetPasswordUsingToken(userId, request.getNewPassword(), request.getToken());
    return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build();
  }
1308325
protected static function changePasswordBySecurityAnswer($email, $answer, $newPassword, $login = true)
    {
        if (empty($email)) {
            throw new BadRequestException("Missing required email for password reset confirmation.");
        }

        if (empty($newPassword)) {
            throw new BadRequestException("Missing new password for reset.");
        }

        if (empty($answer)) {
            throw new BadRequestException("Missing security answer.");
        }

        /** @var User $user */
        $user = User::whereEmail($email)->first();

        if (null === $user) {
            // bad code
            throw new NotFoundException("The supplied email and confirmation code were not found in the system.");
        }

        static::isAllowed($user);

        try {
            // validate answer
            $isValid = \Hash::check($answer, $user->security_answer);
        } catch (\Exception $ex) {
            throw new InternalServerErrorException("Error validating security answer.\n{$ex->getMessage()}");
        }

        if (!$isValid) {
            throw new BadRequestException("The answer supplied does not match.");
        }

        try {
            $user->password = $newPassword;
            $user->save();
        } catch (\Exception $ex) {
            throw new InternalServerErrorException("Error processing password change.\n{$ex->getMessage()}");
        }

        if ($login) {
            static::userLogin($email, $newPassword);

            return ['success' => true, 'session_token' => Session::getSessionToken()];
        }

        return ['success' => true];
    }
1002004
@Help(help = "Change a user's password")
  public void changePassword(String oldPassword, String newPassword) throws SDKException {
    HashMap<String, String> requestBody = new HashMap<>();
    requestBody.put("old_pwd", oldPassword);
    requestBody.put("new_pwd", newPassword);

    requestPut("changepwd", requestBody);
  }
1061787
public void changePassword(final String oldPassword,
            final String newPassword) {

        final Authentication currentUser =
                SecurityContextHolder.getContext().getAuthentication();
        final String username = currentUser.getName();

        if (authenticationManager == null) {
            logger.debug(
                    "No authentication manager set. can't change Password!");

            return;
        } else {
            logger.debug("Re-authenticating user '" + username
                    + "' for password change request.");

            authenticationManager.authenticate(
                    new UsernamePasswordAuthenticationToken(username,
                            oldPassword));
        }

        logger.debug("Changing password for user '" + username + "'");

        final SecurityUser user = (SecurityUser) loadUserByUsername(username);

        user.setPassword(passwordEncoder.encode(newPassword));
        users.add(user);
    }
677981
def change_password(self, usrname, oldpwd, newpwd, callback=None):
        '''
        
        '''
        params = {'usrName': usrname,
                  'oldPwd' : oldpwd,
                  'newPwd' : newpwd,
                 }
        return self.execute_command('changePassword',
                                    params, callback=callback)
39814
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 = Encryption::encrypt($this->secret, new Buffer($newPassword))
            ->getBuffer();

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

        $this->encryptedSecret = $encryptedSecret;

        return [
            'encrypted_secret' => EncryptionMnemonic::encode($encryptedSecret),
        ];
    }
647280
public static SanePasswordProvider forUsernameAndPassword(
      final String username, final String password) {
    return new SanePasswordProvider() {
      @Override
      public String getUsername(String resource) {
        return username;
      }

      @Override
      public String getPassword(String resource) {
        return password;
      }

      @Override
      public boolean canAuthenticate(String resource) {
        return true;
      }
    };
  }
315271
public void setUser(String userName, String password){
        if(userName != null && ! userName.isEmpty()){
            connection.setDirectoryUser(userName, password);
        }
    }
891203
public function resetPassword($newPassword)
    {
        $success = false;
        if (!$this->isForgotPasswordTokenExpired()) {
            $this->password = $newPassword;
            $this->setAttribute(self::FORGOT_PASSWORD_EXPIRATION_FIELD, time()); // expire token
            $this->setTrustedAction(true);
            $success = $this->save();
        }

        return $success;
    }
587330
protected function changePasswordImpl(User $user, $oldPassword, $newPassword, $newPasswordRepeated) {
    $message = $this->getMessage();
    // check old password
    if (!$user->verifyPassword($oldPassword)) {
      throw new IllegalArgumentException($message->getText("The old password is incorrect"));
    }
    if (strlen($newPassword) == 0) {
      throw new IllegalArgumentException($message->getText("The password can't be empty"));
    }
    if ($newPassword != $newPasswordRepeated) {
      throw new IllegalArgumentException($message->getText("The given passwords don't match"));
    }
    // set password
    $user->setPassword($newPassword);
  }
644573
def modify_password(self, username, newpwd, oldpwd):
        
        ret = self.command(
            'userManager.cgi?action=modifyPassword&name={0}&pwd={1}'
            '&pwdOld={2}'.format(username, newpwd, oldpwd)
        )
        return ret.content.decode('utf-8')
312255
public function resetPassword(User $user, string $newPassword)
    {
        $this->enforcePasswordStrength($newPassword);

        $auth = $this->authenticationProvider->findByUserId($user->getId());
        if (!$auth) {
            throw new NoSuchUserException();
        }

        $hash = password_hash($newPassword, PASSWORD_DEFAULT);
        $auth->setHash($hash);
        $this->resetAuthenticationKey($auth);
        $this->authenticationProvider->update($auth);
    }