跳到主要内容

changeUserPassword

EmployeeFullWrapper changeUserPassword(userId, ChangePasswordRequest)

PUT /api/2.0/people/{userId}/password

Change a user password

Sets a new password on an account, which is the step that completes a password change or a password recovery. The request has to carry the confirmation token from the emailed link rather than an ordinary session, and an expired or already used token is answered with 401. The account has to exist and be Active, so the password of a disabled account or of an open invitation cannot be set, and only the portal owner may set the owner's own password. Send either passwordHash, which is taken as it is, or a plain password, which is checked against the portal password policy; sending neither, or a password the policy rejects, answers 400. The change ends every other session of that account and emails it a notice that the password was changed. The answer is the profile, which does not carry the password in any form. To have the recovery link sent in the first place, use POST api/2.0/people/password.

Parameters​

NameInTypeDescriptionNotes
userIdpathUUID (uuid)The ID of the account whose password is set, taken from the route. It has to match the account the confirmation token was issued for, and the account has to be active.[required] [example: 00000000-0000-0000-0000-000000000000]
ChangePasswordRequestbodyChangePasswordRequestThe new password, sent either in plain text or already hashed. Exactly one of the two fields is needed.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The profile whose password was changedEmployeeFullWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The user ID is empty, no password was sent, or the password does not meet the portal policy--
403The account is not active, or only its owner may change this password--
404No account has the specified ID--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

EmployeeFullWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json