diff --git a/apis/account.go b/apis/account.go index f0d9897..7be619c 100644 --- a/apis/account.go +++ b/apis/account.go @@ -337,7 +337,7 @@ func register(c *fiber.Ctx, email, password string, batch bool) error { // @Accept json // @Produce json // @Router /register [put] -// @Router /register [patch] +// @Router /register/_webvpn [patch] // @Param json body RegisterRequest true "json" // @Success 200 {object} TokenResponse // @Failure 400 {object} common.MessageResponse "验证码错误" diff --git a/apis/routes.go b/apis/routes.go index 7eba13e..c0b93b0 100644 --- a/apis/routes.go +++ b/apis/routes.go @@ -32,7 +32,7 @@ func RegisterRoutes(app *fiber.App) { routes.Get("/verify/apikey", VerifyWithApikey) routes.Post("/register", Register) routes.Put("/register", ChangePassword) - routes.Patch("/register", ChangePassword) + routes.Patch("/register/_webvpn", ChangePassword) routes.Delete("/users/me", DeleteUser) routes.Delete("/users/:id", DeleteUserByID) @@ -53,7 +53,7 @@ func RegisterRoutes(app *fiber.App) { routes.Get("/users/:id", GetUserByID) routes.Get("/users", ListUsers) routes.Put("/users/:id", ModifyUser) - routes.Patch("/users/:id/_modify", ModifyUser) + routes.Patch("/users/:id/_webvpn", ModifyUser) // shamir routes.Get("/shamir/status", GetShamirStatus) @@ -63,7 +63,7 @@ func RegisterRoutes(app *fiber.App) { routes.Post("/shamir/key", UploadPublicKey) routes.Post("/shamir/update", UpdateShamir) routes.Put("/shamir/refresh", RefreshShamir) - routes.Patch("/shamir/refresh", RefreshShamir) + routes.Patch("/shamir/refresh/_webvpn", RefreshShamir) routes.Post("/shamir/decrypt", UploadUserShares) routes.Get("/shamir/decrypt/:id", GetDecryptedUserEmail) routes.Get("/shamir/decrypt/status/:id", GetDecryptStatusbyUserID) diff --git a/apis/shamir.go b/apis/shamir.go index 5d32c10..ae5862e 100644 --- a/apis/shamir.go +++ b/apis/shamir.go @@ -333,7 +333,7 @@ func UpdateShamir(c *fiber.Ctx) error { // @Summary trigger for refresh uploaded shares // @Tags shamir // @Router /shamir/refresh [put] -// @Router /shamir/refresh [patch] +// @Router /shamir/refresh/_webvpn [patch] // @Success 204 // @Failure 403 {object} common.MessageResponse "非管理员" // @failure 500 {object} common.MessageResponse diff --git a/apis/user.go b/apis/user.go index 188f5bb..5d6fc65 100644 --- a/apis/user.go +++ b/apis/user.go @@ -95,7 +95,7 @@ func ListAdmin(c *fiber.Ctx) error { // @Tags user // @Produce json // @Router /users/{user_id} [put] -// @Router /users/{user_id}/_modify [patch] +// @Router /users/{user_id}/_webvpn [patch] // @Param user_id path int true "UserID" // @Success 201 {object} User // @Failure 403 {object} common.MessageResponse "不是管理员" diff --git a/docs/docs.go b/docs/docs.go index 986f326..4571591 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -320,7 +320,9 @@ const docTemplate = `{ } } } - }, + } + }, + "/register/_webvpn": { "patch": { "description": "reset password, reset jwt credential", "consumes": [ @@ -753,7 +755,9 @@ const docTemplate = `{ } } } - }, + } + }, + "/shamir/refresh/_webvpn": { "patch": { "tags": [ "shamir" @@ -1239,7 +1243,7 @@ const docTemplate = `{ } } }, - "/users/{user_id}/_modify": { + "/users/{user_id}/_webvpn": { "patch": { "description": "modify user, owner or admin", "produces": [ diff --git a/docs/swagger.json b/docs/swagger.json index 426a739..5963aec 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -314,7 +314,9 @@ } } } - }, + } + }, + "/register/_webvpn": { "patch": { "description": "reset password, reset jwt credential", "consumes": [ @@ -747,7 +749,9 @@ } } } - }, + } + }, + "/shamir/refresh/_webvpn": { "patch": { "tags": [ "shamir" @@ -1233,7 +1237,7 @@ } } }, - "/users/{user_id}/_modify": { + "/users/{user_id}/_webvpn": { "patch": { "description": "modify user, owner or admin", "produces": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2ec405f..b08dc99 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -538,10 +538,10 @@ paths: tags: - token /register: - patch: + post: consumes: - application/json - description: reset password, reset jwt credential + description: register with email, password and verification code parameters: - description: json in: body @@ -552,25 +552,25 @@ paths: produces: - application/json responses: - "200": - description: OK + "201": + description: Created schema: $ref: '#/definitions/apis.TokenResponse' "400": - description: 验证码错误 + description: 验证码错误、用户已注册 schema: $ref: '#/definitions/common.MessageResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/common.MessageResponse' - summary: reset password + summary: register tags: - account - post: + put: consumes: - application/json - description: register with email, password and verification code + description: reset password, reset jwt credential parameters: - description: json in: body @@ -581,22 +581,23 @@ paths: produces: - application/json responses: - "201": - description: Created + "200": + description: OK schema: $ref: '#/definitions/apis.TokenResponse' "400": - description: 验证码错误、用户已注册 + description: 验证码错误 schema: $ref: '#/definitions/common.MessageResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/common.MessageResponse' - summary: register + summary: reset password tags: - account - put: + /register/_webvpn: + patch: consumes: - application/json description: reset password, reset jwt credential @@ -891,7 +892,7 @@ paths: tags: - shamir /shamir/refresh: - patch: + put: responses: "204": description: No Content @@ -906,7 +907,8 @@ paths: summary: trigger for refresh uploaded shares tags: - shamir - put: + /shamir/refresh/_webvpn: + patch: responses: "204": description: No Content @@ -1117,7 +1119,7 @@ paths: summary: modify user tags: - user - /users/{user_id}/_modify: + /users/{user_id}/_webvpn: patch: description: modify user, owner or admin parameters: