From 7e054ee0fe43ef6bdef29a8f04cd2f4217b0db18 Mon Sep 17 00:00:00 2001 From: rainzm Date: Thu, 22 Apr 2021 11:42:54 +0800 Subject: [PATCH] fix(region): admin update without verification --- pkg/notify/models/receiver.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/notify/models/receiver.go b/pkg/notify/models/receiver.go index e023750bc1..0378f87601 100644 --- a/pkg/notify/models/receiver.go +++ b/pkg/notify/models/receiver.go @@ -809,10 +809,6 @@ func (r *SReceiver) PreUpdate(ctx context.Context, userCred mcclient.TokenCreden if err != nil { log.Errorf("PushCache: %v", err) } - err = ReceiverManager.TableSpec().InsertOrUpdate(ctx, r) - if err != nil { - log.Errorf("InsertOrUpdate: %v", err) - } // 管理后台修改联系人,如果修改或者启用手机号和邮箱,无需进行校验 allowScope := policy.PolicyManager.AllowScope(userCred, api.SERVICE_TYPE, ReceiverManager.KeywordPlural(), policy.PolicyActionCreate) if allowScope == rbacutils.ScopeSystem { @@ -831,6 +827,10 @@ func (r *SReceiver) PreUpdate(ctx context.Context, userCred mcclient.TokenCreden r.VerifiedMobile = tristate.True } } + err = ReceiverManager.TableSpec().InsertOrUpdate(ctx, r) + if err != nil { + log.Errorf("InsertOrUpdate: %v", err) + } } func (r *SReceiver) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) {