Added auth to the container.
This commit is contained in:
parent
c9d50cb3d4
commit
a33a76f8bc
9 changed files with 81 additions and 32 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package routes
|
||||
|
||||
import (
|
||||
"goweb/auth"
|
||||
"goweb/context"
|
||||
"goweb/controller"
|
||||
"goweb/msg"
|
||||
|
|
@ -57,7 +56,7 @@ func (r *Register) Post(c echo.Context) error {
|
|||
}
|
||||
|
||||
// Hash the password
|
||||
pwHash, err := auth.HashPassword(form.Password)
|
||||
pwHash, err := r.Container.Auth.HashPassword(form.Password)
|
||||
if err != nil {
|
||||
return fail("unable to hash password", err)
|
||||
}
|
||||
|
|
@ -76,7 +75,7 @@ func (r *Register) Post(c echo.Context) error {
|
|||
|
||||
c.Logger().Infof("user created: %s", u.Name)
|
||||
|
||||
err = auth.Login(c, u.ID)
|
||||
err = r.Container.Auth.Login(c, u.ID)
|
||||
if err != nil {
|
||||
c.Logger().Errorf("unable to log in: %v", err)
|
||||
msg.Info(c, "Your account has been created.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue