@Override
    public void execute(@Nonnull final SessionData data, Element command) {
        final Locale preferredLocale = SessionManager.getInstance().getLocaleForSession(data.getOwner());

        Element note = command.addElement("note");
        // Check if groups cannot be modified (backend is read-only)
        if (UserManager.getUserProvider().isReadOnly()) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.changeuserpassword.note.users-readonly", preferredLocale));
            return;
        }
        JID account;
        try {
            account = new JID(data.getData().get("accountjid").get(0));
        } catch (IllegalArgumentException e) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.changeuserpassword.note.jid-invalid", preferredLocale));
            return;
        }
        catch (NullPointerException ne) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.changeuserpassword.note.jid-required", preferredLocale));
            return;
        }
        if (!XMPPServer.getInstance().isLocal(account)) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.changeuserpassword.note.jid-not-local", preferredLocale));
            return;
        }
        String newPassword = data.getData().get("password").get(0);

        // Get requested group
        User user;
        try {
            user = UserManager.getInstance().getUser(account.getNode());
        } catch (UserNotFoundException e) {
            // Group not found
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.changeuserpassword.note.user-does-not-exist", preferredLocale));
            return;
        }
        // Set the new passowrd of the user
        user.setPassword(newPassword);
        // Answer that the operation was successful
        note.addAttribute("type", "info");
        note.setText(LocaleUtils.getLocalizedString("commands.global.operation.finished.success", preferredLocale));
    }
Command that allows to change password of existing users.

@author Gaston Dombiak
@see <a href="https://xmpp.org/extensions/xep-0133.html#change-user-password">XEP-0133 Service Administration: Change User Password</a>
xmppserver/src/main/java/org/jivesoftware/openfire/commands/admin/user/ChangeUserPassword.java