mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 10:17:37 +02:00
Fix activation of primary email addresses (#16385)
* fix: primary email cannot be activated * Primary email should be activated together with user account when 'RegisterEmailConfirm' is enabled. * To fix the existing error state. When 'RegisterEmailConfirm' is enabled, the admin should have permission to modify the activations status of user email. And the user should be allowed to send activation to primary email. * Only judge whether email is primary from email_address table. * Improve logging and refactor isEmailActive Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
1 parent
56b7f53329
commit
423a0fccb6
5 files changed
+62
-55
No files matched your search
@@ -125,8 +125,8 @@ func ActivateEmail(ctx *context.Context) {
|
||||
|
||||
log.Info("Changing activation for User ID: %d, email: %s, primary: %v to %v", uid, email, primary, activate)
|
||||
|
||||
if err := models.ActivateUserEmail(uid, email, primary, activate); err != nil {
|
||||
log.Error("ActivateUserEmail(%v,%v,%v,%v): %v", uid, email, primary, activate, err)
|
||||
if err := models.ActivateUserEmail(uid, email, activate); err != nil {
|
||||
log.Error("ActivateUserEmail(%v,%v,%v): %v", uid, email, activate, err)
|
||||
if models.IsErrEmailAlreadyUsed(err) {
|
||||
ctx.Flash.Error(ctx.Tr("admin.emails.duplicate_active"))
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user