aboutsummaryrefslogtreecommitdiff
path: root/src/user
diff options
context:
space:
mode:
Diffstat (limited to 'src/user')
-rw-r--r--src/user/hooks.go2
-rw-r--r--src/user/routes.go5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/user/hooks.go b/src/user/hooks.go
index 61e24bc..c7b7632 100644
--- a/src/user/hooks.go
+++ b/src/user/hooks.go
@@ -8,7 +8,7 @@ import (
"gitlab.com/alexkavon/newsstand/src/models"
)
-func init() {
+func InitHooks() {
models.AddUserHook(boil.BeforeInsertHook, validateNew)
// should always be last
models.AddUserHook(boil.BeforeInsertHook, hashSecretBeforeInsert)
diff --git a/src/user/routes.go b/src/user/routes.go
index 862545a..eaf4582 100644
--- a/src/user/routes.go
+++ b/src/user/routes.go
@@ -10,6 +10,10 @@ import (
"gitlab.com/alexkavon/newsstand/src/sessions"
)
+func init() {
+ InitHooks()
+}
+
var Routes = server.Routes{
server.Route{
Name: "Create",
@@ -73,7 +77,6 @@ func Store(s *server.Server) http.HandlerFunc {
if err != nil {
log.Fatal("Insert Error", err)
}
- // Send email validation
// Create cookie session
sessions.NewSession(w, sessions.SessionValues{"uid": user.ID, "username": user.Username})
// Redirect to user profile