Improve user error handling.

This commit is contained in:
Gucheng Wang
2021-12-12 19:59:55 +08:00
parent 96e2f286ee
commit f4265d015a
5 changed files with 16 additions and 5 deletions

View File

@ -179,7 +179,7 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU
user := GetUser(userId)
if user == nil {
return &Code{
Message: "Invalid user_id",
Message: fmt.Sprintf("The user: %s doesn't exist", userId),
Code: "",
}
}

View File

@ -313,6 +313,10 @@ func AddUser(user *User) bool {
user.Id = util.GenerateId()
}
if user.Owner == "" || user.Name == "" {
return false
}
organization := GetOrganizationByUser(user)
user.UpdateUserPassword(organization)