tsk-30: Update password (#33)
Closes #30 Reviewed-on: phoenix/textsender-auth#33 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
+114
@@ -275,9 +275,89 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/password/update": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Update the password of a regular account (requires JWT)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"users"
|
||||
],
|
||||
"summary": "Update Password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Needed data to update password",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"git_kundeng_us_phoenix_textsender-models_tx0_user.User": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_login": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone_number": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.LoginAccount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -417,6 +497,37 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.UpdatePasswordRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"confirmed_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"current_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.UpdatePasswordResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/git_kundeng_us_phoenix_textsender-models_tx0_user.User"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"token.Login": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -428,6 +539,9 @@ const docTemplate = `{
|
||||
},
|
||||
"token_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -269,9 +269,89 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/password/update": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Update the password of a regular account (requires JWT)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"users"
|
||||
],
|
||||
"summary": "Update Password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Needed data to update password",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.UpdatePasswordResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"git_kundeng_us_phoenix_textsender-models_tx0_user.User": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_login": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone_number": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.LoginAccount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -411,6 +491,37 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.UpdatePasswordRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"confirmed_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"current_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.UpdatePasswordResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/git_kundeng_us_phoenix_textsender-models_tx0_user.User"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"token.Login": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -422,6 +533,9 @@
|
||||
},
|
||||
"token_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
basePath: /api/v1
|
||||
definitions:
|
||||
git_kundeng_us_phoenix_textsender-models_tx0_user.User:
|
||||
properties:
|
||||
date_created:
|
||||
type: string
|
||||
first_name:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
last_login:
|
||||
type: string
|
||||
last_name:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone_number:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
handler.LoginAccount:
|
||||
properties:
|
||||
password:
|
||||
@@ -89,6 +108,26 @@ definitions:
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
handler.UpdatePasswordRequest:
|
||||
properties:
|
||||
confirmed_password:
|
||||
type: string
|
||||
current_password:
|
||||
type: string
|
||||
updated_password:
|
||||
type: string
|
||||
user_id:
|
||||
type: string
|
||||
type: object
|
||||
handler.UpdatePasswordResponse:
|
||||
properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/git_kundeng_us_phoenix_textsender-models_tx0_user.User'
|
||||
type: array
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
token.Login:
|
||||
properties:
|
||||
access_token:
|
||||
@@ -97,6 +136,8 @@ definitions:
|
||||
type: integer
|
||||
token_type:
|
||||
type: string
|
||||
user_id:
|
||||
type: string
|
||||
type: object
|
||||
user.ServiceUser:
|
||||
properties:
|
||||
@@ -280,6 +321,38 @@ paths:
|
||||
summary: Obtain a refresh token
|
||||
tags:
|
||||
- refresh
|
||||
/user/password/update:
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Update the password of a regular account (requires JWT)
|
||||
parameters:
|
||||
- description: Needed data to update password
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/handler.UpdatePasswordRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/handler.UpdatePasswordResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/handler.UpdatePasswordResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/handler.UpdatePasswordResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Update Password
|
||||
tags:
|
||||
- users
|
||||
securityDefinitions:
|
||||
BearerAuth:
|
||||
description: JWT Bearer Token
|
||||
|
||||
Reference in New Issue
Block a user