[ADD] generate UUID if it's not set (#338)
* support openID2.0 * generate UUID if it's not set
This commit is contained in:
parent
ecc736be8b
commit
91700ab93e
|
@ -34,6 +34,7 @@ _test
|
|||
/etc/log/log.test.json
|
||||
/data*
|
||||
/tarball
|
||||
/run
|
||||
|
||||
.idea
|
||||
.index
|
||||
|
|
|
@ -205,6 +205,10 @@ func (u *User) Save() error {
|
|||
return fmt.Errorf("user.id[%d] not equal 0", u.Id)
|
||||
}
|
||||
|
||||
if u.UUID == "" {
|
||||
u.UUID = GenUUIDForUser(u.Username)
|
||||
}
|
||||
|
||||
cnt, err := DB["rdb"].Where("username=?", u.Username).Count(new(User))
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue