diff options
author | Jonas Östanbäck <cez81@users.noreply.github.com> | 2017-05-29 09:35:47 +0200 |
---|---|---|
committer | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-05-29 02:35:47 -0500 |
commit | b93568cce4717abd97f1f92341ce9fdf331a7e98 (patch) | |
tree | 9234c805be991b8d1876bb4641d07b1f6f1251c8 /routers | |
parent | e0c6ab2d44d17b72a7ea6f8b4c829c42baeaae3b (diff) | |
download | gitea-b93568cce4717abd97f1f92341ce9fdf331a7e98.tar.gz gitea-b93568cce4717abd97f1f92341ce9fdf331a7e98.zip |
xxx_active_code_live setting in printed in hours and minutes instead … (#1814)
* xxx_active_code_live setting in printed in hours and minutes instead of just hours
* Update app.ini description of xxx_code_lives settings
Diffstat (limited to 'routers')
-rw-r--r-- | routers/dev/template.go | 4 | ||||
-rw-r--r-- | routers/user/auth.go | 10 | ||||
-rw-r--r-- | routers/user/auth_openid.go | 2 | ||||
-rw-r--r-- | routers/user/setting.go | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/routers/dev/template.go b/routers/dev/template.go index fae85a3968..fc3ef9942e 100644 --- a/routers/dev/template.go +++ b/routers/dev/template.go @@ -18,8 +18,8 @@ func TemplatePreview(ctx *context.Context) { ctx.Data["AppVer"] = setting.AppVer ctx.Data["AppUrl"] = setting.AppURL ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374" - ctx.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60 - ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60 + ctx.Data["ActiveCodeLives"] = base.MinutesToFriendly(setting.Service.ActiveCodeLives) + ctx.Data["ResetPwdCodeLives"] = base.MinutesToFriendly(setting.Service.ResetPwdCodeLives) ctx.Data["CurDbValue"] = "" ctx.HTML(200, base.TplName(ctx.Params("*"))) diff --git a/routers/user/auth.go b/routers/user/auth.go index 856b47bdd1..d1a6fc8a97 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -677,7 +677,7 @@ func LinkAccountPostRegister(ctx *context.Context, cpt *captcha.Captcha, form au models.SendActivateAccountMail(ctx.Context, u) ctx.Data["IsSendRegisterMail"] = true ctx.Data["Email"] = u.Email - ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 + ctx.Data["ActiveCodeLives"] = base.MinutesToFriendly(setting.Service.ActiveCodeLives) ctx.HTML(200, TplActivate) if err := ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil { @@ -792,7 +792,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo models.SendActivateAccountMail(ctx.Context, u) ctx.Data["IsSendRegisterMail"] = true ctx.Data["Email"] = u.Email - ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 + ctx.Data["ActiveCodeLives"] = base.MinutesToFriendly(setting.Service.ActiveCodeLives) ctx.HTML(200, TplActivate) if err := ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil { @@ -818,7 +818,7 @@ func Activate(ctx *context.Context) { if ctx.Cache.IsExist("MailResendLimit_" + ctx.User.LowerName) { ctx.Data["ResendLimited"] = true } else { - ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 + ctx.Data["ActiveCodeLives"] = base.MinutesToFriendly(setting.Service.ActiveCodeLives) models.SendActivateAccountMail(ctx.Context, ctx.User) if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil { @@ -913,7 +913,7 @@ func ForgotPasswdPost(ctx *context.Context) { u, err := models.GetUserByEmail(email) if err != nil { if models.IsErrUserNotExist(err) { - ctx.Data["Hours"] = setting.Service.ResetPwdCodeLives / 60 + ctx.Data["ResetPwdCodeLives"] = base.MinutesToFriendly(setting.Service.ResetPwdCodeLives) ctx.Data["IsResetSent"] = true ctx.HTML(200, tplForgotPassword) return @@ -940,7 +940,7 @@ func ForgotPasswdPost(ctx *context.Context) { log.Error(4, "Set cache(MailResendLimit) fail: %v", err) } - ctx.Data["Hours"] = setting.Service.ResetPwdCodeLives / 60 + ctx.Data["ResetPwdCodeLives"] = base.MinutesToFriendly(setting.Service.ResetPwdCodeLives) ctx.Data["IsResetSent"] = true ctx.HTML(200, tplForgotPassword) } diff --git a/routers/user/auth_openid.go b/routers/user/auth_openid.go index 7d4df342e9..15bbe41c14 100644 --- a/routers/user/auth_openid.go +++ b/routers/user/auth_openid.go @@ -415,7 +415,7 @@ func RegisterOpenIDPost(ctx *context.Context, cpt *captcha.Captcha, form auth.Si models.SendActivateAccountMail(ctx.Context, u) ctx.Data["IsSendRegisterMail"] = true ctx.Data["Email"] = u.Email - ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 + ctx.Data["ActiveCodeLives"] = base.MinutesToFriendly(setting.Service.ActiveCodeLives) ctx.HTML(200, TplActivate) if err := ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil { diff --git a/routers/user/setting.go b/routers/user/setting.go index 4fff19ef63..8fa9834167 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -297,7 +297,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) { if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil { log.Error(4, "Set cache(MailResendLimit) fail: %v", err) } - ctx.Flash.Info(ctx.Tr("settings.add_email_confirmation_sent", email.Email, setting.Service.ActiveCodeLives/60)) + ctx.Flash.Info(ctx.Tr("settings.add_email_confirmation_sent", email.Email, base.MinutesToFriendly(setting.Service.ActiveCodeLives))) } else { ctx.Flash.Success(ctx.Tr("settings.add_email_success")) } |