Added Ent and user model.

This commit is contained in:
mikestefanello 2021-12-10 20:44:23 -05:00
parent 259c666548
commit 79d2db3c1f
28 changed files with 4145 additions and 13 deletions

View file

@ -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)
}