diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index db37e77..51c4ec6 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -120,7 +120,9 @@ func (app *application) signupUser(w http.ResponseWriter, r *http.Request) { } func (app *application) loginUserForm(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, "display user login form") + app.render(w, r, "login.page.tmpl", &templateData{ + Form: forms.New(nil), + }) } func (app *application) loginUser(w http.ResponseWriter, r *http.Request) { diff --git a/cmd/web/routes.go b/cmd/web/routes.go index e8419e1..2b21307 100644 --- a/cmd/web/routes.go +++ b/cmd/web/routes.go @@ -20,7 +20,7 @@ func (app *application) routes() http.Handler { mux.Get("/users/signup", dynamicMiddleware.ThenFunc(app.signupUserForm)) mux.Post("/users/signup", dynamicMiddleware.ThenFunc(app.signupUser)) - mux.Get("/usesr/login", dynamicMiddleware.ThenFunc(app.loginUserForm)) + mux.Get("/users/login", dynamicMiddleware.ThenFunc(app.loginUserForm)) mux.Post("/users/login", dynamicMiddleware.ThenFunc(app.loginUser)) mux.Post("/users/logout", dynamicMiddleware.ThenFunc(app.logoutUser)) diff --git a/ui/html/login.page.tmpl b/ui/html/login.page.tmpl new file mode 100644 index 0000000..53dfe0f --- /dev/null +++ b/ui/html/login.page.tmpl @@ -0,0 +1,25 @@ +{{ template "base" . }} + +{{ define "title" }}Login{{ end }} + +{{ define "main" }} +
+ {{ with .Form }} + {{ with .Errors.Get "generic" }} +
{{ . }}
+ {{ end }} +
+ + +
+
+ + +
+
+ +
+{{ end }} +
+{{ end }} + diff --git a/ui/html/signup.page.tmpl b/ui/html/signup.page.tmpl index b40304a..f552da7 100644 --- a/ui/html/signup.page.tmpl +++ b/ui/html/signup.page.tmpl @@ -31,4 +31,4 @@ {{ end }} -{{ end }} \ No newline at end of file +{{ end }}