Enonic 4.7 Change password from Java API

Enonic version: 4.7.13
OS: Windows Server 2008 R2 Enterprice

I’m trying to change the password by using the Java API. I use the Java API to do other operations already, so I know that the “connection” works with my credentials.

The ChangeUserPasswordParams takes 3 parameters.

  • password
  • username
  • userstore

This is so simple that I can’t understand how I can get it wrong. I’ve tried a bunch of combinations for the username field, including the users username, the users email, userstore + "\" + username, but nothing works.

Is it possible that this interface is broken?

I can look into it later today.

1 Like

Sorry. Didn’t have time yesterday. Will try to look at this as soon as possible.

1 Like

Hi Tom!

I just tried this on our 4.7.14-SNAPSHOT, and had no problems. Here is the code I used:

public void test_change_user_password()
    ChangeUserPasswordParams params = new ChangeUserPasswordParams();
    params.username = "frodekippe";
    params.userstore = "local";
    params.password = "fki123";

    Client client = loginUserStoreAdminUser();
    client.changeUserPassword( params );

where local is the name of the userstore, as it appears in the tree in Admin, and username is the username, as it appears in the last word in the breadcrumb-path on the first line, if you open the user in the admin:

  • Userstores / local / Users / frodekippe

Do you get any errors in the log?

Hi Jørgen,

Thanks for taking the time to look at this for me. :slight_smile:

I could exclude som error-sources from my code, based on your answer, and I have it working now. (tbh, I don’t know exactly what the bug was, but at least the code is working)

And I didn’t get any errors in the log.

Glad to hear that you got a working solution! :slight_smile: