feat: recover password & refresh token
This commit is contained in:
+196
-42
@@ -24,6 +24,46 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/admin/users": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Fetches all users",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Fetches all users",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/store.User"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authentication/forgot-password": {
|
||||
"post": {
|
||||
"description": "Forgot Password",
|
||||
@@ -70,6 +110,92 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authentication/refresh": {
|
||||
"post": {
|
||||
"description": "Refresh a token for the user",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"authentication"
|
||||
],
|
||||
"summary": "Refresh a token",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Refresh Token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Token Created",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authentication/register": {
|
||||
"post": {
|
||||
"description": "Register a new User",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"authentication"
|
||||
],
|
||||
"summary": "Register a new User",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User Credentials",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/main.RegisterUserPayload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "User Registered",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/main.UserWithToken"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "User payload error",
|
||||
"schema": {}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authentication/token": {
|
||||
"post": {
|
||||
"description": "Create a new token for the user",
|
||||
@@ -116,48 +242,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authentication/user": {
|
||||
"post": {
|
||||
"description": "Register a new User",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"authentication"
|
||||
],
|
||||
"summary": "Register a new User",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User Credentials",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/main.RegisterUserPayload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "User Registered",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/main.UserWithToken"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "User payload error",
|
||||
"schema": {}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"description": "Health Check",
|
||||
@@ -555,6 +639,61 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/reset-password/{token}": {
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Reset user password with verification",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"users"
|
||||
],
|
||||
"summary": "Reset user password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Reset Password",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/main.resetPasswordPayload"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Reset Password Token",
|
||||
"name": "token",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Password reset successfully",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request",
|
||||
"schema": {}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -935,6 +1074,21 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"main.resetPasswordPayload": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"new_password",
|
||||
"new_password_confirmation"
|
||||
],
|
||||
"properties": {
|
||||
"new_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"new_password_confirmation": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"main.updateUserPasswordPayload": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user