summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-21 10:09:57 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-21 10:09:57 -0400
commitd40499e7fa3d62655431f160b6909d9751dabe11 (patch)
treee02d35f7494e4ba2234de5c0b954553ff9c57709 /routers/user
parent67c4e5429818b501b0db5527ea38f2be75e5df55 (diff)
downloadgitea-d40499e7fa3d62655431f160b6909d9751dabe11.tar.gz
gitea-d40499e7fa3d62655431f160b6909d9751dabe11.zip
Finsih mail resend limit
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
}