User Passwords API
Content
Single user password:
- [POST] send password reset token with email by user
- [POST] send password reset token with user ID by admin
- [PUT] set new password
General notes
User passwords are used for resetting passwords. Reset tokens are sent to user's email.
Send password token by user
POST /api/v0/passwords/user
Method for sending password reset token to provided email address.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
email | string | User login email | Required |
POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"email": "john.doe@example.com"
}
Responses
204 NO CONTENT
Email with reset token was sent.
403 FORBIDDEN
There is a time limit before sending new reset token. Forbidden, because time limit not passed yet.
POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"type": "Forbidden",
"message": "You can send a new token only after 10 minutes have passed since the previous one.",
"id": "b1e61001-b910-44f2-a31e-9b4133a213ad"
}
404 NOT FOUND
Given email was not found in users
POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"type": "NotFound",
"message": "The entered email does not exist in the system.",
"id": "823a99c1-37d1-4edf-9610-0485684fec0f"
}
Send password token by admin
POST /api/v0/passwords/user/{userId}
This method needs permission
createonusers.
Request
| Index behaviour | Definition |
|---|---|
| Embedded | - |
POST /api/v0/passwords/user/1
Responses
204 NO CONTENT
Email with reset token was sent.
403 FORBIDDEN
There is a time limit before sending new reset token. Forbidden, because time limit not passed yet.
POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"type": "Forbidden",
"message": "You can send a new token only after 10 minutes have passed since the previous one.",
"id": "b1e61001-b910-44f2-a31e-9b4133a213ad"
}
404 NOT FOUND
Given email was not found in users
POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"type": "NotFound",
"message": "The entered email does not exist in the system.",
"id": "823a99c1-37d1-4edf-9610-0485684fec0f"
}
Set new password
PUT /api/v0/passwords/user
Method for updating user password.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
email | string | User login email | Required |
token | string | Generated user password reset token | Required |
new_password | string | User new password | Required |
new_password_confirmation | string | User new password again | Required |
PUT /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"email": "john.doe@example.com",
"token": "V1am22VEEJiB4DXChtF0Ds7gdoZz0HPVDHKl0qHz",
"new_password": "PasswordThatIsSafe159",
"new_password_confirmation": "PasswordThatIsSafe159"
}
Responses
204 NO CONTENT
Password was successfully set.
422 UNPROCESSABLE CONTENT
Validation error occurred.
PUT /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"type": "ValidationError",
"message": "Pole musí být delší než 8 znaků.",
"id": "b38b4baf-0c35-4e35-94a6-a56380a65c91",
"errors": [
{
"field": "new_password",
"message": "Pole musí být delší než 8 znaků."
}
]
}
498 INVALID TOKEN
Token has expired
PUT /api/v0/passwords/user HTTP/1.1
Content-Type: application/json
{
"type": "ExpiredToken",
"message": "The specified token has already expired.",
"id": "477b7164-d8c8-41bf-8b99-cd2248f57788"
}