mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 19:40:19 +08:00
Improve user error handling.
This commit is contained in:
@ -162,10 +162,13 @@ func (c *ApiController) Signup() {
|
||||
}
|
||||
|
||||
affected := object.AddUser(user)
|
||||
if affected {
|
||||
original.AddUserToOriginalDatabase(user)
|
||||
if !affected {
|
||||
c.ResponseError(fmt.Sprintf("Failed to create user, user information is invalid: %s", util.StructToJson(user)))
|
||||
return
|
||||
}
|
||||
|
||||
original.AddUserToOriginalDatabase(user)
|
||||
|
||||
if application.HasPromptPage() {
|
||||
// The prompt page needs the user to be signed in
|
||||
c.SetSessionUsername(user.GetId())
|
||||
|
Reference in New Issue
Block a user