[GITEA] Allow changing the email address before activation (squash) cache is always active

This needs to be revisited because the MailResendLimit is not enforced
and turns out to not be tested.

See e7cb8da2a8 * Always enable caches (#28527)
This commit is contained in:
Earl Warren 2023-12-25 14:06:57 +01:00
parent e21252f147
commit 43ded8ee30
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 1 additions and 3 deletions

View file

@ -696,7 +696,7 @@ func ActivatePost(ctx *context.Context) {
}
// Change the primary email
if setting.Service.RegisterEmailConfirm {
if setting.CacheService.Enabled && ctx.Cache.IsExist("MailResendLimit_"+ctx.Doer.LowerName) {
if false && ctx.Cache.IsExist("MailResendLimit_"+ctx.Doer.LowerName) {
ctx.Data["ResendLimited"] = true
} else {
ctx.Data["ActiveCodeLives"] = timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, ctx.Locale)

View file

@ -99,7 +99,6 @@ func TestSignupEmailChangeForInactiveUser(t *testing.T) {
// Disable the captcha & enable email confirmation for registrations
defer test.MockVariableValue(&setting.Service.EnableCaptcha, false)()
defer test.MockVariableValue(&setting.Service.RegisterEmailConfirm, true)()
defer test.MockVariableValue(&setting.CacheService.Enabled, false)()
// Create user
req := NewRequestWithValues(t, "POST", "/user/sign_up", map[string]string{
@ -133,7 +132,6 @@ func TestSignupEmailChangeForActiveUser(t *testing.T) {
// Disable the captcha & enable email confirmation for registrations
defer test.MockVariableValue(&setting.Service.EnableCaptcha, false)()
defer test.MockVariableValue(&setting.Service.RegisterEmailConfirm, false)()
defer test.MockVariableValue(&setting.CacheService.Enabled, false)()
// Create user
req := NewRequestWithValues(t, "POST", "/user/sign_up", map[string]string{