mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Use GenerateIdForNewUser() in add-user API
This commit is contained in:
parent
f40d44fa1c
commit
b6d6aa9d04
@ -615,9 +615,18 @@ func UpdateUserForAllFields(id string, user *User) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddUser(user *User) (bool, error) {
|
func AddUser(user *User) (bool, error) {
|
||||||
var err error
|
|
||||||
if user.Id == "" {
|
if user.Id == "" {
|
||||||
user.Id = util.GenerateId()
|
application, err := GetApplicationByUser(user)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
id, err := GenerateIdForNewUser(application)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
user.Id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.Owner == "" || user.Name == "" {
|
if user.Owner == "" || user.Name == "" {
|
||||||
@ -633,7 +642,7 @@ func AddUser(user *User) (bool, error) {
|
|||||||
user.UpdateUserPassword(organization)
|
user.UpdateUserPassword(organization)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = user.UpdateUserHash()
|
err := user.UpdateUserHash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user