From 846282db74e59053ea287da9849147fdf86f3650 Mon Sep 17 00:00:00 2001 From: vinchent Date: Mon, 12 Aug 2024 21:38:12 +0200 Subject: [PATCH] create login page --- cmd/web/handlers.go | 6 +++++ cmd/web/routes.go | 3 +++ cmd/web/templates/base.layout.gohtml | 5 ++++ cmd/web/templates/login.page.gohtml | 38 ++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 cmd/web/templates/login.page.gohtml diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index 401d524..b97c83e 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -283,3 +283,9 @@ func (app *application) BronzePlanReceipt(w http.ResponseWriter, r *http.Request app.errorLog.Println(err) } } + +func (app *application) LoginPage(w http.ResponseWriter, r *http.Request) { + if err := app.renderTemplate(w, r, "login", &templateData{}); err != nil { + app.errorLog.Println(err) + } +} diff --git a/cmd/web/routes.go b/cmd/web/routes.go index 9b8c681..312890e 100644 --- a/cmd/web/routes.go +++ b/cmd/web/routes.go @@ -22,6 +22,9 @@ func (app *application) routes() http.Handler { mux.Get("/plans/bronze", app.BronzePlan) mux.Get("/receipt/bronze", app.BronzePlanReceipt) + // auth routes + mux.Get("/login", app.LoginPage) + fileServer := http.FileServer(http.Dir("./static")) mux.Handle("/static/*", http.StripPrefix("/static", fileServer)) diff --git a/cmd/web/templates/base.layout.gohtml b/cmd/web/templates/base.layout.gohtml index feba797..6632865 100644 --- a/cmd/web/templates/base.layout.gohtml +++ b/cmd/web/templates/base.layout.gohtml @@ -51,6 +51,11 @@ + diff --git a/cmd/web/templates/login.page.gohtml b/cmd/web/templates/login.page.gohtml new file mode 100644 index 0000000..59f4f94 --- /dev/null +++ b/cmd/web/templates/login.page.gohtml @@ -0,0 +1,38 @@ +{{ template "base" . }} +{{ define "title" }} +Login +{{ end }} +{{ define "content" }} +
+

Login

+
+
+ + +
+
+ + +
+
+ Login +
+{{ end }} +{{define "js"}} +{{end}}