mirror of
https://github.com/cuigh/swirl
synced 2024-12-27 06:13:00 +00:00
Fix #54
This commit is contained in:
parent
8a6a7babc8
commit
2a0b701b46
@ -70,13 +70,18 @@ func userSignIn(auth *security.Identifier, eb biz.EventBiz) web.HandlerFunc {
|
||||
|
||||
func userSave(b biz.UserBiz) web.HandlerFunc {
|
||||
return func(c web.Context) error {
|
||||
user := &dao.User{}
|
||||
err := c.Bind(user, true)
|
||||
args := &struct {
|
||||
Password string `json:"password"`
|
||||
*dao.User
|
||||
}{}
|
||||
err := c.Bind(args, true)
|
||||
if err == nil {
|
||||
ctx, cancel := misc.Context(defaultTimeout)
|
||||
defer cancel()
|
||||
|
||||
user := args.User
|
||||
if user.ID == "" {
|
||||
user.Password = args.Password
|
||||
_, err = b.Create(ctx, user, c.User())
|
||||
} else {
|
||||
err = b.Update(ctx, user, c.User())
|
||||
|
Loading…
Reference in New Issue
Block a user