@@ -427,14 +427,13 @@ func ChangePassword(c *fiber.Ctx) error {
427427// @Produce json
428428// @Router /verify/email/{email} [get]
429429// @Param email path string true "email"
430- // @Param scope query string false "scope"
431430// @Success 200 {object} EmailVerifyResponse
432431// @Failure 400 {object} common.MessageResponse “email不在白名单中”
433432// @Failure 500 {object} common.MessageResponse
434433func VerifyWithEmailOld (c * fiber.Ctx ) error {
435434 email := c .Params ("email" )
436- scope := c .Query ("scope" )
437- return verifyWithEmail (c , email , scope , false )
435+ // scope := c.Query("scope")
436+ return verifyWithEmail (c , email , false )
438437}
439438
440439// VerifyWithEmail godoc
@@ -445,20 +444,19 @@ func VerifyWithEmailOld(c *fiber.Ctx) error {
445444// @Produce json
446445// @Router /verify/email [get]
447446// @Param email query string true "email"
448- // @Param scope query string false "scope"
449447// @Param check query bool false "check"
450448// @Success 200 {object} EmailVerifyResponse
451449// @Failure 400 {object} common.MessageResponse
452450// @Failure 403 {object} common.MessageResponse “email不在白名单中”
453451// @Failure 500 {object} common.MessageResponse
454452func VerifyWithEmail (c * fiber.Ctx ) error {
455453 email := c .Query ("email" )
456- scope := c .Query ("scope" )
454+ // scope := c.Query("scope")
457455 check := c .QueryBool ("check" )
458- return verifyWithEmail (c , email , scope , check )
456+ return verifyWithEmail (c , email , check )
459457}
460458
461- func verifyWithEmail (c * fiber.Ctx , email , givenScope string , check bool ) error {
459+ func verifyWithEmail (c * fiber.Ctx , email string , check bool ) error {
462460 if ! utils .ValidateEmail (email ) {
463461 return common .BadRequest ("email invalid" )
464462 }
@@ -478,11 +476,9 @@ func verifyWithEmail(c *fiber.Ctx, email, givenScope string, check bool) error {
478476 return err
479477 }
480478
481- var scope string
479+ scope := "reset"
482480 if ! registered {
483481 scope = "register"
484- } else {
485- scope = "reset"
486482 }
487483
488484 if check {
@@ -497,11 +493,6 @@ func verifyWithEmail(c *fiber.Ctx, email, givenScope string, check bool) error {
497493 })
498494 }
499495
500- if givenScope == "register" && scope == "reset" {
501- return common .BadRequest ("该用户已注册,请使用重置密码功能" )
502- } else if givenScope == "reset" && scope == "register" {
503- return common .BadRequest ("该用户未注册,请先注册账户" )
504- }
505496 code , err := auth .SetVerificationCode (email , scope )
506497 if err != nil {
507498 return err
0 commit comments