@ -105,7 +105,7 @@ func EmailPost(ctx *context.Context) {
// Send activation Email
// Send activation Email
if ctx . FormString ( "_method" ) == "SENDACTIVATION" {
if ctx . FormString ( "_method" ) == "SENDACTIVATION" {
var address string
var address string
if ctx . Cache . IsExist ( "MailResendLimit_" + ctx . Doer . LowerName ) {
if setting . CacheService . Enabled && ctx . Cache . IsExist ( "MailResendLimit_" + ctx . Doer . LowerName ) {
log . Error ( "Send activation: activation still pending" )
log . Error ( "Send activation: activation still pending" )
ctx . Redirect ( setting . AppSubURL + "/user/settings/account" )
ctx . Redirect ( setting . AppSubURL + "/user/settings/account" )
return
return
@ -141,8 +141,10 @@ func EmailPost(ctx *context.Context) {
}
}
address = email . Email
address = email . Email
if err := ctx . Cache . Put ( "MailResendLimit_" + ctx . Doer . LowerName , ctx . Doer . LowerName , 180 ) ; err != nil {
if setting . CacheService . Enabled {
log . Error ( "Set cache(MailResendLimit) fail: %v" , err )
if err := ctx . Cache . Put ( "MailResendLimit_" + ctx . Doer . LowerName , ctx . Doer . LowerName , 180 ) ; err != nil {
log . Error ( "Set cache(MailResendLimit) fail: %v" , err )
}
}
}
ctx . Flash . Info ( ctx . Tr ( "settings.add_email_confirmation_sent" , address , timeutil . MinutesToFriendly ( setting . Service . ActiveCodeLives , ctx . Locale . Language ( ) ) ) )
ctx . Flash . Info ( ctx . Tr ( "settings.add_email_confirmation_sent" , address , timeutil . MinutesToFriendly ( setting . Service . ActiveCodeLives , ctx . Locale . Language ( ) ) ) )
ctx . Redirect ( setting . AppSubURL + "/user/settings/account" )
ctx . Redirect ( setting . AppSubURL + "/user/settings/account" )
@ -201,8 +203,10 @@ func EmailPost(ctx *context.Context) {
// Send confirmation email
// Send confirmation email
if setting . Service . RegisterEmailConfirm {
if setting . Service . RegisterEmailConfirm {
mailer . SendActivateEmailMail ( ctx . Doer , email )
mailer . SendActivateEmailMail ( ctx . Doer , email )
if err := ctx . Cache . Put ( "MailResendLimit_" + ctx . Doer . LowerName , ctx . Doer . LowerName , 180 ) ; err != nil {
if setting . CacheService . Enabled {
log . Error ( "Set cache(MailResendLimit) fail: %v" , err )
if err := ctx . Cache . Put ( "MailResendLimit_" + ctx . Doer . LowerName , ctx . Doer . LowerName , 180 ) ; err != nil {
log . Error ( "Set cache(MailResendLimit) fail: %v" , err )
}
}
}
ctx . Flash . Info ( ctx . Tr ( "settings.add_email_confirmation_sent" , email . Email , timeutil . MinutesToFriendly ( setting . Service . ActiveCodeLives , ctx . Locale . Language ( ) ) ) )
ctx . Flash . Info ( ctx . Tr ( "settings.add_email_confirmation_sent" , email . Email , timeutil . MinutesToFriendly ( setting . Service . ActiveCodeLives , ctx . Locale . Language ( ) ) ) )
} else {
} else {
@ -273,7 +277,7 @@ func loadAccountData(ctx *context.Context) {
user_model . EmailAddress
user_model . EmailAddress
CanBePrimary bool
CanBePrimary bool
}
}
pendingActivation := ctx . Cache . IsExist ( "MailResendLimit_" + ctx . Doer . LowerName )
pendingActivation := setting . CacheService . Enabled && ctx . Cache . IsExist ( "MailResendLimit_" + ctx . Doer . LowerName )
emails := make ( [ ] * UserEmail , len ( emlist ) )
emails := make ( [ ] * UserEmail , len ( emlist ) )
for i , em := range emlist {
for i , em := range emlist {
var email UserEmail
var email UserEmail