Fix prompt redirect logic and db sync bug.

This commit is contained in:
Yang Luo
2021-06-20 13:27:26 +08:00
parent d3a8ab8347
commit a43db3e55a
8 changed files with 126 additions and 7 deletions

View File

@ -22,6 +22,7 @@ import (
"strings"
"github.com/casdoor/casdoor/object"
"github.com/casdoor/casdoor/original"
"github.com/casdoor/casdoor/util"
)
@ -151,7 +152,11 @@ func (c *ApiController) Signup() {
IsForbidden: false,
Properties: map[string]string{},
}
object.AddUser(user)
affected := object.AddUser(user)
if affected {
original.AddUserToOriginalDatabase(user)
}
if application.HasPromptPage() {
// The prompt page needs the user to be signed in

View File

@ -20,6 +20,7 @@ import (
"strings"
"github.com/casdoor/casdoor/object"
"github.com/casdoor/casdoor/original"
)
// @Title GetGlobalUsers
@ -75,7 +76,13 @@ func (c *ApiController) UpdateUser() {
return
}
c.Data["json"] = wrapActionResponse(object.UpdateUser(id, &user))
affected := object.UpdateUser(id, &user)
if affected {
newUser := object.GetUser(user.GetId())
original.UpdateUserToOriginalDatabase(newUser)
}
c.Data["json"] = wrapActionResponse(affected)
c.ServeJSON()
}