diff --git a/documentation/docs-index.js b/documentation/docs-index.js index f9cd5929..cce0cb47 100644 --- a/documentation/docs-index.js +++ b/documentation/docs-index.js @@ -42,7 +42,8 @@ module.exports = { "auth/logout", "auth/register", "auth/recover", - "auth/token" + "auth/confirm", + "auth/finish-recovery" ] }, }; diff --git a/documentation/docs/auth/token.md b/documentation/docs/auth/confirm.md similarity index 91% rename from documentation/docs/auth/token.md rename to documentation/docs/auth/confirm.md index 8655bfdd..b758f236 100644 --- a/documentation/docs/auth/token.md +++ b/documentation/docs/auth/confirm.md @@ -1,8 +1,8 @@ --- -id: token +id: confirm title: Confirm Recovery Token sidebar_label: Confirm Recovery Token -slug: /auth/token +slug: /auth/confirm --- import Tabs from '@theme/Tabs'; @@ -13,7 +13,7 @@ import Highlight from "../../src/highlight.js" ## Details This endpoint is used to check if the given token is valid to recover an account. -The token can be generated by using the [recover](./recover.md) endpoint and is sent to the user by email. +The token can be generated by using the [recover](./recover) endpoint and is sent to the user by email. **URL** : `/auth/recover/:token/confirm` diff --git a/documentation/docs/auth/finish-recovery.md b/documentation/docs/auth/finish-recovery.md new file mode 100644 index 00000000..6fd5ab4f --- /dev/null +++ b/documentation/docs/auth/finish-recovery.md @@ -0,0 +1,142 @@ +--- +id: finish-recovery +title: Finish Password Recovery +sidebar_label: Finish Password Recovery +slug: /auth/finish-recovery +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +import Highlight from "../../src/highlight.js" + +## Details + +This endpoint is used to change the password of an account, given a previously generated token. +The token can be generated by using the [recover](./recover) endpoint and is sent to the user by email. + +**URL** : `/auth/recover/:token/confirm` + +**Method** : POST + +## Parameters + +### password + +Body Parameter +Required +
+String +Min Length: 8 + +New password for the account. Must contain at least one number. + +## Request examples + +### Example 1 - Valid Token + +**Code** : 200 OK + + + + + +```json +{ + "password": "newpassword123" +} +``` + + + + + +```json +{} +``` + + + + +### Example 2 - Invalid Token + +**Code** : 403 FORBIDDEN + + + + + +```bash +/auth/recover/invalid/confirm +``` + + + + + +```json +{ + "error_code": 3, + "errors": [ + { + "msg": "invalid-token" + } + ] +} +``` + + + + +### Example 3 - Password Without Numbers + +**Code** : 422 UNPROCESSABLE ENTITY + + + + + +```json +{ + "password": "newpassword" +} +``` + + + + + +```json +{ + "error_code": 1, + "errors": [ + { + "value": "newpassword", + "msg": "must-contain-number", + "param": "password", + "location": "body" + } + ] +} +``` + + + diff --git a/documentation/docs/auth/recover.md b/documentation/docs/auth/recover.md index f2e0338b..cecc0d9e 100644 --- a/documentation/docs/auth/recover.md +++ b/documentation/docs/auth/recover.md @@ -21,6 +21,10 @@ Returns 200 status even if the account doesn't exist (for safety purposes). **Method** : POST +:::info Following steps +To continue the flow of recovering an account, see [confirm token](./confirm) and [finish recovery](./finish-recovery). +::: + ## Parameters ### email