From e2f6efd1ab0d1ee6e03856f5ac158cbafaa5312c Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sun, 9 May 2021 14:54:17 +0800 Subject: [PATCH] Add user.PreHash --- object/user.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/object/user.go b/object/user.go index 4088d04f..05686922 100644 --- a/object/user.go +++ b/object/user.go @@ -42,6 +42,7 @@ type User struct { IsGlobalAdmin bool `json:"isGlobalAdmin"` IsForbidden bool `json:"isForbidden"` Hash string `xorm:"varchar(100)" json:"hash"` + PreHash string `xorm:"varchar(100)" json:"preHash"` Github string `xorm:"varchar(100)" json:"github"` Google string `xorm:"varchar(100)" json:"google"` @@ -107,6 +108,7 @@ func UpdateUser(id string, user *User) bool { func AddUser(user *User) bool { user.Id = util.GenerateId() user.UpdateUserHash() + user.PreHash = user.Hash affected, err := adapter.Engine.Insert(user) if err != nil { @@ -119,6 +121,7 @@ func AddUser(user *User) bool { func AddUsers(users []*User) bool { for _, user := range users { user.UpdateUserHash() + user.PreHash = user.Hash } affected, err := adapter.Engine.Insert(users)