Added Ent and user model.
This commit is contained in:
parent
259c666548
commit
79d2db3c1f
28 changed files with 4145 additions and 13 deletions
|
|
@ -20,6 +20,18 @@ func (r *Register) Get(c echo.Context) error {
|
|||
}
|
||||
|
||||
func (r *Register) Post(c echo.Context) error {
|
||||
u, err := r.Container.Ent.User.
|
||||
Create().
|
||||
SetUsername(c.FormValue("username")).
|
||||
SetPassword(c.FormValue("password")).
|
||||
Save(c.Request().Context())
|
||||
|
||||
if err != nil {
|
||||
c.Logger().Error(err)
|
||||
} else {
|
||||
c.Logger().Infof("user created: %s", u.Username)
|
||||
}
|
||||
|
||||
msg.Danger(c, "Registration is currently disabled.")
|
||||
return r.Get(c)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue