fix: with error pq: column "DingTalk" of relation "user" does not exist (#1116)

* feat: add dingtalk union_id

* fix: with pg, column Dingtalk of relation user table does not exist.

* Update user_util.go

Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:
tom2nonames 2022-09-10 13:08:37 +08:00 committed by GitHub
parent e8d2906e3c
commit 8456b7f7c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,7 @@ func SetUserField(user *User, field string, value string) bool {
value = user.Password
}
affected, err := adapter.Engine.Table(user).ID(core.PK{user.Owner, user.Name}).Update(map[string]interface{}{field: value})
affected, err := adapter.Engine.Table(user).ID(core.PK{user.Owner, user.Name}).Update(map[string]interface{}{strings.ToLower(field): value})
if err != nil {
panic(err)
}
@ -141,9 +141,6 @@ func SetUserOAuthProperties(organization *Organization, user *User, providerType
if userInfo.UnionId != "" {
propertyName := fmt.Sprintf("oauth_%s_unionId", providerType)
setUserProperty(user, propertyName, userInfo.UnionId)
if providerType == "DingTalk" && user.DingTalk == "" {
user.DingTalk = userInfo.UnionId
}
}
if userInfo.AvatarUrl != "" {