mirror of
https://github.com/cuigh/swirl
synced 2025-01-30 22:37:21 +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 {
|
func userSave(b biz.UserBiz) web.HandlerFunc {
|
||||||
return func(c web.Context) error {
|
return func(c web.Context) error {
|
||||||
user := &dao.User{}
|
args := &struct {
|
||||||
err := c.Bind(user, true)
|
Password string `json:"password"`
|
||||||
|
*dao.User
|
||||||
|
}{}
|
||||||
|
err := c.Bind(args, true)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
ctx, cancel := misc.Context(defaultTimeout)
|
ctx, cancel := misc.Context(defaultTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
user := args.User
|
||||||
if user.ID == "" {
|
if user.ID == "" {
|
||||||
|
user.Password = args.Password
|
||||||
_, err = b.Create(ctx, user, c.User())
|
_, err = b.Create(ctx, user, c.User())
|
||||||
} else {
|
} else {
|
||||||
err = b.Update(ctx, user, c.User())
|
err = b.Update(ctx, user, c.User())
|
||||||
|
Loading…
Reference in New Issue
Block a user