summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/user.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/routers/user/user.go b/routers/user/user.go
index 40b594ab80..d38eb1ceb3 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -167,6 +167,10 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) {
ctx.Data["Email"] = u.Email
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
ctx.HTML(200, "user/active")
+
+ if err = ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil {
+ log.Error("Set cache(MailResendLimit) fail: %v", err)
+ }
return
}
ctx.Redirect("/user/login")
@@ -247,8 +251,12 @@ func Activate(ctx *middleware.Context) {
}
// Resend confirmation e-mail.
if base.Service.RegisterEmailConfirm {
- ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
- mailer.SendActiveMail(ctx.Render, ctx.User)
+ if ctx.Cache.IsExist("MailResendLimit_" + ctx.User.LowerName) {
+ ctx.Data["ResendLimited"] = true
+ } else {
+ ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
+ mailer.SendActiveMail(ctx.Render, ctx.User)
+ }
} else {
ctx.Data["ServiceNotEnabled"] = true
}