fix: harden auth flows and align api contracts
This commit is contained in:
@@ -24,7 +24,7 @@ func NewCaptchaHandler(captchaService *service.CaptchaService) *CaptchaHandler {
|
||||
// @Tags 验证码
|
||||
// @Produce json
|
||||
// @Success 200 {object} Response{data=CaptchaResponse} "验证码信息"
|
||||
// @Router /api/v1/captcha/generate [get]
|
||||
// @Router /api/v1/auth/captcha [get]
|
||||
func (h *CaptchaHandler) GenerateCaptcha(c *gin.Context) {
|
||||
result, err := h.captchaService.Generate(c.Request.Context())
|
||||
if err != nil {
|
||||
@@ -49,7 +49,7 @@ func (h *CaptchaHandler) GenerateCaptcha(c *gin.Context) {
|
||||
// @Produce json
|
||||
// @Param captcha_id query string false "验证码ID"
|
||||
// @Success 200 {object} Response "验证码图片"
|
||||
// @Router /api/v1/captcha/image [get]
|
||||
// @Router /api/v1/auth/captcha/image [get]
|
||||
func (h *CaptchaHandler) GetCaptchaImage(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "message": "success"})
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func (h *CaptchaHandler) GetCaptchaImage(c *gin.Context) {
|
||||
// @Param request body VerifyCaptchaRequest true "验证码信息"
|
||||
// @Success 200 {object} Response{data=VerifyResponse} "验证成功"
|
||||
// @Failure 400 {object} Response "验证码无效"
|
||||
// @Router /api/v1/captcha/verify [post]
|
||||
// @Router /api/v1/auth/captcha/verify [post]
|
||||
func (h *CaptchaHandler) VerifyCaptcha(c *gin.Context) {
|
||||
var req struct {
|
||||
CaptchaID string `json:"captcha_id" binding:"required"`
|
||||
|
||||
Reference in New Issue
Block a user