Skip to content

Commit 5149fcd

Browse files
committed
API documentation added for password change from web ui without bcrypt hash
Signed-off-by: Rajshekar Chavakula <rchavakula.ctr@sumologic.com>
1 parent 72f65c8 commit 5149fcd

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

content/sensu-go/6.10/api/core/users.md

+46
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,52 @@ payload | {{< code shell >}}
337337
{{< /code >}}
338338
response codes | <ul><li>**Success**: 201 (Created)</li><li>**Malformed**: 400 (Bad Request)</li><li>**Error**: 500 (Internal Server Error)</li></ul>
339339

340+
## Change your password without bcrypt hash {#usersuserpasswordwithouthash-put}
341+
342+
The `/users/:user/change_password` API endpoint provides HTTP PUT access to change your Sensu user password.
343+
344+
{{% notice note %}}
345+
**NOTE**: The `/users/:user/change_password` API endpoint allows a user to update their own password, without any permissions.
346+
This differs from the `/users/:user/reset_password` API endpoint, which requires explicit [`users` permissions](../../../operations/control-access/rbac/#users) to change the user password.
347+
{{% /notice %}}
348+
349+
### Example {#usersuserpasswordwithouthash-put-example}
350+
351+
In the following example, an HTTP PUT request is submitted to the `/users/:user/password` API endpoint to update the password for the user `alice`.
352+
353+
The `password` is your current password in cleartext.
354+
The `password_new` is your new password in cleartext.
355+
356+
{{< code shell >}}
357+
curl -X PUT \
358+
-H "Authorization: Key $SENSU_API_KEY" \
359+
-H 'Content-Type: application/json' \
360+
-d '{
361+
"username": "alice",
362+
"password": "P@ssw0rd!",
363+
"password_new": "P@ssw0rd!123"
364+
}' \
365+
http://127.0.0.1:8080/api/core/v2/users/alice/change_password
366+
{{< /code >}}
367+
368+
The request will return a successful `HTTP/1.1 201 Created` response.
369+
370+
### API Specification {#usersuserpassword-put-specification}
371+
372+
/users/:user/change_password (PUT) |
373+
----------------|------
374+
description | Changes the password for the specified Sensu user without usage of [bcrypt][3] hash.
375+
example URL | http://hostname:8080/api/core/v2/users/alice/change_password
376+
payload parameters | Required: <ul><li>`username`: string; the username for the Sensu user</li><li>`password`: string; the user's current password in cleartext</li><li>`password_new`: string; the user's new password in cleartext</li></ul>
377+
payload | {{< code shell >}}
378+
{
379+
"username": "alice",
380+
"password": "P@ssw0rd!",
381+
"password_new": "P@ssw0rd!123"
382+
}
383+
{{< /code >}}
384+
response codes | <ul><li>**Success**: 201 (Created)</li><li>**Malformed**: 400 (Bad Request)</li><li>**Error**: 500 (Internal Server Error)</li></ul>
385+
340386
## Reinstate a disabled user {#usersuserreinstate-put}
341387

342388
The `/users/:user/reinstate` API endpoint provides HTTP PUT access to reinstate a disabled user.

0 commit comments

Comments
 (0)