mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
feature: verify user with sms code (#14858)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -63,6 +63,20 @@ func (self *SubcontactPullTask) OnInit(ctx context.Context, obj db.IStandaloneMo
|
||||
self.SetStageComplete(ctx, nil)
|
||||
return
|
||||
}
|
||||
// sync email and mobile to keystone
|
||||
s := auth.GetSession(ctx, self.UserCred, "")
|
||||
mobile := receiver.Mobile
|
||||
if strings.HasPrefix(mobile, "+86 ") {
|
||||
mobile = strings.TrimSpace(mobile[4:])
|
||||
}
|
||||
params := map[string]string{
|
||||
"email": receiver.Email,
|
||||
"mobile": receiver.Mobile,
|
||||
}
|
||||
_, err := identity.UsersV3.Update(s, receiver.Id, jsonutils.Marshal(params))
|
||||
if err != nil {
|
||||
log.Errorf("update user email and mobile fail %s", err)
|
||||
}
|
||||
var contactTypes []string
|
||||
if self.Params.Contains("contact_types") {
|
||||
jArray, _ := self.Params.Get("contact_types")
|
||||
@@ -94,7 +108,7 @@ func (self *SubcontactPullTask) OnInit(ctx context.Context, obj db.IStandaloneMo
|
||||
receiver.MarkContactTypeVerified(cType)
|
||||
}
|
||||
// push cache
|
||||
err := receiver.PushCache(ctx)
|
||||
err = receiver.PushCache(ctx)
|
||||
if err != nil {
|
||||
reason := fmt.Sprintf("PushCache: %v", err)
|
||||
self.taskFailed(ctx, receiver, reason)
|
||||
@@ -105,20 +119,6 @@ func (self *SubcontactPullTask) OnInit(ctx context.Context, obj db.IStandaloneMo
|
||||
self.taskFailed(ctx, receiver, reason)
|
||||
return
|
||||
}
|
||||
// sync email and mobile to keystone
|
||||
s := auth.GetSession(ctx, self.UserCred, "")
|
||||
mobile := receiver.Mobile
|
||||
if strings.HasPrefix(mobile, "+86 ") {
|
||||
mobile = strings.TrimSpace(mobile[4:])
|
||||
}
|
||||
params := map[string]string{
|
||||
"email": receiver.Email,
|
||||
"mobile": receiver.Mobile,
|
||||
}
|
||||
_, err = identity.UsersV3.Update(s, receiver.Id, jsonutils.Marshal(params))
|
||||
if err != nil {
|
||||
log.Errorf("update user email and mobile fail %s", err)
|
||||
}
|
||||
// success
|
||||
receiver.SetStatus(self.UserCred, apis.RECEIVER_STATUS_READY, "")
|
||||
logclient.AddActionLogWithContext(ctx, receiver, logclient.ACT_PULL_SUBCONTACT, "", self.UserCred, true)
|
||||
|
||||
Reference in New Issue
Block a user