MCPcopy Create free account
hub / github.com/apache/answer / UserVerifyEmail

Method UserVerifyEmail

internal/controller/user_controller.go:317–338  ·  view source on GitHub ↗

UserVerifyEmail godoc @Summary UserVerifyEmail @Description UserVerifyEmail @Tags User @Accept json @Produce json @Param code query string true "code" default() @Success 200 {object} handler.RespBody{data=schema.UserLoginResp} @Router /answer/api/v1/user/email/verification [post]

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

315// @Success 200 {object} handler.RespBody{data=schema.UserLoginResp}
316// @Router /answer/api/v1/user/email/verification [post]
317func (uc *UserController) UserVerifyEmail(ctx *gin.Context) {
318 req := &schema.UserVerifyEmailReq{}
319 if handler.BindAndCheck(ctx, req) {
320 return
321 }
322
323 req.Content = uc.emailService.VerifyUrlExpired(ctx, req.Code)
324 if len(req.Content) == 0 {
325 handler.HandleResponse(ctx, errors.Forbidden(reason.EmailVerifyURLExpired),
326 &schema.ForbiddenResp{Type: schema.ForbiddenReasonTypeURLExpired})
327 return
328 }
329
330 resp, err := uc.userService.UserVerifyEmail(ctx, req)
331 if err != nil {
332 handler.HandleResponse(ctx, err, nil)
333 return
334 }
335
336 uc.actionService.ActionRecordDel(ctx, entity.CaptchaActionEmail, ctx.ClientIP())
337 handler.HandleResponse(ctx, err, resp)
338}
339
340// UserVerifyEmailSend godoc
341// @Summary UserVerifyEmailSend

Callers

nothing calls this directly

Calls 4

BindAndCheckFunction · 0.92
HandleResponseFunction · 0.92
VerifyUrlExpiredMethod · 0.80
ActionRecordDelMethod · 0.80

Tested by

no test coverage detected