fix: Returns a valid userId when form.Username is empty (#523)

* fix: Returns a valid userId when form.Username is empty

* fix: format code
This commit is contained in:
fuh 2022-03-04 23:39:12 +08:00 committed by GitHub
parent 1d0af9cf7b
commit a783315fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,8 +130,6 @@ func (c *ApiController) Signup() {
}
}
userId := fmt.Sprintf("%s/%s", form.Organization, form.Username)
id := util.GenerateId()
if application.GetSignupItemRule("ID") == "Incremental" {
lastUser := object.GetLastUser(form.Organization)
@ -203,6 +201,7 @@ func (c *ApiController) Signup() {
record.User = user.Name
go object.AddRecord(record)
userId := fmt.Sprintf("%s/%s", user.Owner, user.Name)
util.LogInfo(c.Ctx, "API: [%s] is signed up as new user", userId)
c.ResponseOk(userId)