Unicat API Reference

Up - API Reference - Home


/api/reset_password

Complete a password reset request. If successful, you get a new JWT (so you are logged in) and your new password will work from this moment forward.

Note: resetting a forgotten password is a two-step process; the first step initiates the action (see /api/reset_password_request), this is the second step that completes it.

Request

POST /api/reset_password

{
    "username": "<your-username-here>",
    "new_password": "<a-new-password>",
    "validation_code": "<validation-code-from-response>",
    "verification_code": "<verification-code-from-email>",
}

username is the username returned from step 1. If multiple usernames were returned, one must be chosen. A username is case-sensitive.
new_password is a newly chosen password, it should be a strong one.
validation_code is the validation code returned from step 1.
verification_code is the 6-character code received by email. This one-time code is valid for 15 minutes.

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "user": "<user gid>",
        "user_projects": {
            "<project gid>": [
                "owner"
            ],
            
        }
    },
    "data": {
        "cc.users": {
            "<user gid>": {
                "gid": "<user gid>",
                "username": "user-name",
                "email": "<user email>",
                "name": "User Name",
                "avatar": "1ad71cbd-9b97-4ea7-94ef-bcdd86c6467c.jpg",
                "status": "active",
                "options": {
                    "language": "en",
                    "timezone": "Europe/Amsterdam"
                }
            }
        },
        "cc.projects": {
            "<project gid>": {
                "gid": "<project gid>",
                "name": "Project Name",
                "icon": "<project gid>.jpg",
                "owner": "<user gid>",
                "status": "active"
            },
            
        },
        "cc.projects_members": [
            {
                "project_gid": "<project gid>",
                "user_gid": "<user gid>",
                "status": "active",
                "roles": [
                    "owner"
                ],
                "options": {
                    "notifications": {
                        "email": "<user email>",
                        "events": [
                            "all"
                        ],
                        "frequency": "immediate"
                    },
                    "rate_limit_per_second": null
                }
            },
            
        ],
        "cc.languages": {
            "da": "Danish",
            "nl": "Dutch",
            
        },
    }
}

The JWT you need is in the Authorization header.

result

user is the user gid if the password reset is successful - you are now logged in (see JWT).
user_projects is a dictionary of zero or more projects that are owned by this user or the user is a member of.

data

cc.users is a dictionary with a single entry for the current user.
cc.projects is a dictionary with metadata for each project.
cc.projects_members is a list with metadata for project-owner membership (other members are not included if there is no active project).
cc.languages available languages for internationalization and localization.

Error response

400 Bad request - missing parameters (only the first is reported)
422 Unprocessable entity - user not found
1001 Validation error - invalid verification/validation codes, weak password - see Validation information