Add error codes on routes (#34)

Fix #33
This commit is contained in:
François Voron
2019-10-31 10:10:53 +01:00
committed by GitHub
parent b512197094
commit 658161518a
4 changed files with 56 additions and 14 deletions

View File

@@ -31,6 +31,12 @@ Register a new user. Will call the `on_after_register` [event handlers](../confi
!!! fail "`400 Bad Request`"
A user already exists with this email.
```json
{
"detail": "REGISTER_USER_ALREADY_EXISTS"
}
```
### `POST /login`
Login a user.
@@ -52,6 +58,12 @@ Login a user.
!!! fail "`400 Bad Request`"
Bad credentials or the user is inactive.
```json
{
"detail": "LOGIN_BAD_CREDENTIALS"
}
```
### `POST /forgot-password`
Request a reset password procedure. Will generate a temporary token and call the `on_after_forgot_password` [event handlers](../configuration/router.md#event-handlers) if the user exists.
@@ -86,6 +98,12 @@ Reset a password. Requires the token generated by the `/forgot-password` route.
!!! fail "`400 Bad Request`"
Bad or expired token.
```json
{
"detail": "RESET_PASSWORD_BAD_TOKEN"
}
```
## Authenticated
### `GET /me`