← Back to team overview

dhis2-devs team mailing list archive

Re: Is it possible to change the passwd of the users using the API??

 

Easiest was would be to GET the current payload of the user,modify the
password to what you want and the POST this payload back, if you are on
2.17.

Regards,
Jason
On Feb 9, 2015 12:56 PM, "Jose Garcia Muñoz" <josemp10@xxxxxxxxx> wrote:

>
> Thanks Jason,
>
> nope, I am using the 2.17. But will migrate to the 2.18 this afternoon.
> Will test it and let you know.
>
> So in the 2.17 I would need to introduce all the information of the user
> again in the payload?
>
> Thanks
> Jose
>
> On Mon, Feb 9, 2015 at 12:46 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
> wrote:
>
>> You need to send the full payload. Are you on 2.18? you could use PATCH
>> for this now.. something like
>>
>> {
>>   "password": "new-password"
>> }
>>
>> curl -X PATCH -d @password.json -u user:pass
>> http://localhost:8080/api/users/ID/password
>>
>> (untested, but should work)
>>
>> --
>> Morten
>>
>> On Mon, Feb 9, 2015 at 6:43 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
>> wrote:
>>
>>>
>>> Thanks Jason,
>>>
>>> sorry, and how should it work? I tried with the following call...
>>>
>>> curl.exe -d @user.json "http://localhost:8080/dhis/api/users/oEiOvqVp3A9";
>>> -H "Content-Type:application/json" -u myuser:mypasswd -v
>>>
>>> where the user.json file just contains
>>>
>>> {
>>>   "username": "the_user_name",
>>>   "password": "the_user_passwd"
>>> }
>>>
>>> But the system gives me an error
>>>
>>> Am I missing something?
>>>
>>> Thanks
>>> Jose
>>>
>>> On Mon, Feb 9, 2015 at 6:13 AM, Jason Pickering <
>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>
>>>> Hi Jose,
>>>>
>>>> Yes, it is possible to send the plain-text password of a user to the
>>>> system using the API, which will then hash the password for you and
>>>> persist it in the database.
>>>>
>>>> Best regards,
>>>> Jason
>>>>
>>>>
>>>>
>>>> On Mon, Feb 9, 2015 at 1:04 AM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
>>>> wrote:
>>>> >
>>>> > Hi devs,
>>>> >
>>>> > I didn't see anything in the documentation in that regard. I could
>>>> only find
>>>> > out the user replication as the only way to specify a user passwd
>>>> using the
>>>> > API. Am I correct?
>>>> >
>>>> > Thanks
>>>> > Jose
>>>> >
>>>> > _______________________________________________
>>>> > Mailing list: https://launchpad.net/~dhis2-devs
>>>> > Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> > Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> > More help   : https://help.launchpad.net/ListHelp
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Jason P. Pickering
>>>> email: jason.p.pickering@xxxxxxxxx
>>>> tel:+46764147049
>>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>

Follow ups

References