@@ -105,7 +105,7 @@ func EmailPost(ctx *context.Context) {
105
105
// Send activation Email
106
106
if ctx .FormString ("_method" ) == "SENDACTIVATION" {
107
107
var address string
108
- if ctx .Cache .IsExist ("MailResendLimit_" + ctx .Doer .LowerName ) {
108
+ if setting . CacheService . Enabled && ctx .Cache .IsExist ("MailResendLimit_" + ctx .Doer .LowerName ) {
109
109
log .Error ("Send activation: activation still pending" )
110
110
ctx .Redirect (setting .AppSubURL + "/user/settings/account" )
111
111
return
@@ -141,8 +141,10 @@ func EmailPost(ctx *context.Context) {
141
141
}
142
142
address = email .Email
143
143
144
- if err := ctx .Cache .Put ("MailResendLimit_" + ctx .Doer .LowerName , ctx .Doer .LowerName , 180 ); err != nil {
145
- log .Error ("Set cache(MailResendLimit) fail: %v" , err )
144
+ if setting .CacheService .Enabled {
145
+ if err := ctx .Cache .Put ("MailResendLimit_" + ctx .Doer .LowerName , ctx .Doer .LowerName , 180 ); err != nil {
146
+ log .Error ("Set cache(MailResendLimit) fail: %v" , err )
147
+ }
146
148
}
147
149
ctx .Flash .Info (ctx .Tr ("settings.add_email_confirmation_sent" , address , timeutil .MinutesToFriendly (setting .Service .ActiveCodeLives , ctx .Locale .Language ())))
148
150
ctx .Redirect (setting .AppSubURL + "/user/settings/account" )
@@ -201,8 +203,10 @@ func EmailPost(ctx *context.Context) {
201
203
// Send confirmation email
202
204
if setting .Service .RegisterEmailConfirm {
203
205
mailer .SendActivateEmailMail (ctx .Doer , email )
204
- if err := ctx .Cache .Put ("MailResendLimit_" + ctx .Doer .LowerName , ctx .Doer .LowerName , 180 ); err != nil {
205
- log .Error ("Set cache(MailResendLimit) fail: %v" , err )
206
+ if setting .CacheService .Enabled {
207
+ if err := ctx .Cache .Put ("MailResendLimit_" + ctx .Doer .LowerName , ctx .Doer .LowerName , 180 ); err != nil {
208
+ log .Error ("Set cache(MailResendLimit) fail: %v" , err )
209
+ }
206
210
}
207
211
ctx .Flash .Info (ctx .Tr ("settings.add_email_confirmation_sent" , email .Email , timeutil .MinutesToFriendly (setting .Service .ActiveCodeLives , ctx .Locale .Language ())))
208
212
} else {
@@ -273,7 +277,7 @@ func loadAccountData(ctx *context.Context) {
273
277
user_model.EmailAddress
274
278
CanBePrimary bool
275
279
}
276
- pendingActivation := ctx .Cache .IsExist ("MailResendLimit_" + ctx .Doer .LowerName )
280
+ pendingActivation := setting . CacheService . Enabled && ctx .Cache .IsExist ("MailResendLimit_" + ctx .Doer .LowerName )
277
281
emails := make ([]* UserEmail , len (emlist ))
278
282
for i , em := range emlist {
279
283
var email UserEmail
0 commit comments