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

Method UseRePassWord

internal/controller/user_controller.go:213–229  ·  view source on GitHub ↗

UseRePassWord godoc @Summary UseRePassWord @Description UseRePassWord @Tags User @Accept json @Produce json @Param data body schema.UserRePassWordRequest true "UserRePassWordRequest" @Success 200 {string} string "" @Router /answer/api/v1/user/password/replacement [post]

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

211// @Success 200 {string} string ""
212// @Router /answer/api/v1/user/password/replacement [post]
213func (uc *UserController) UseRePassWord(ctx *gin.Context) {
214 req := &schema.UserRePassWordRequest{}
215 if handler.BindAndCheck(ctx, req) {
216 return
217 }
218
219 req.Content = uc.emailService.VerifyUrlExpired(ctx, req.Code)
220 if len(req.Content) == 0 {
221 handler.HandleResponse(ctx, errors.Forbidden(reason.EmailVerifyURLExpired),
222 &schema.ForbiddenResp{Type: schema.ForbiddenReasonTypeURLExpired})
223 return
224 }
225
226 err := uc.userService.UpdatePasswordWhenForgot(ctx, req)
227 uc.actionService.ActionRecordDel(ctx, entity.CaptchaActionPassword, ctx.ClientIP())
228 handler.HandleResponse(ctx, err, nil)
229}
230
231// UserLogout user logout
232// @Summary user logout

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected