diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/handler/auth/login.go | 20 | ||||
-rw-r--r-- | pkg/handler/router.go | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/pkg/handler/auth/login.go b/pkg/handler/auth/login.go new file mode 100644 index 0000000..7e77a67 --- /dev/null +++ b/pkg/handler/auth/login.go @@ -0,0 +1,20 @@ +package auth + +import ( + "net/http" + + "git.gabrielgio.me/cerrado/pkg/ext" + "git.gabrielgio.me/cerrado/templates" +) + +type ( + LoginHandler struct{} +) + +func (g *LoginHandler) Login(w http.ResponseWriter, r *http.Request) error { + ext.SetHTML(w) + + login := &templates.LoginPage{} + templates.WritePageTemplate(w, login) + return nil +} diff --git a/pkg/handler/router.go b/pkg/handler/router.go index a2ac98a..32bd78a 100644 --- a/pkg/handler/router.go +++ b/pkg/handler/router.go @@ -6,6 +6,7 @@ import ( serverconfig "git.gabrielgio.me/cerrado/pkg/config" "git.gabrielgio.me/cerrado/pkg/ext" "git.gabrielgio.me/cerrado/pkg/handler/about" + "git.gabrielgio.me/cerrado/pkg/handler/auth" "git.gabrielgio.me/cerrado/pkg/handler/git" "git.gabrielgio.me/cerrado/pkg/handler/static" "git.gabrielgio.me/cerrado/pkg/service" @@ -21,6 +22,7 @@ func MountHandler( var ( gitHandler = git.NewGitHandler(gitService, configRepo) aboutHandler = about.NewAboutHandler(configRepo) + loginHandler = &auth.LoginHandler{} ) staticHandler, err := static.ServeStaticHandler() @@ -33,6 +35,7 @@ func MountHandler( mux.AddMiddleware(ext.Log) mux.HandleFunc("/static/{file}", staticHandler) + mux.HandleFunc("/login/{$}", loginHandler.Login) mux.HandleFunc("/{name}/about/{$}", gitHandler.About) mux.HandleFunc("/{name}/", gitHandler.Summary) mux.HandleFunc("/{name}/refs/{$}", gitHandler.Refs) |