Skip to content

Commit

Permalink
login page
Browse files Browse the repository at this point in the history
  • Loading branch information
Pomog committed Dec 16, 2023
1 parent d9dfe73 commit d8e0c14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/web/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func routes(app *config.AppConfig) http.Handler {
mux.Post("/make-reservation", handlers.Repo.PostReservation)
mux.Get("/reservation-summary", handlers.Repo.ReservationSummary)

mux.Get("/user-login", handlers.Repo.ShowLogin)

fileServer := http.FileServer(http.Dir("./static/"))
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))

Expand Down
6 changes: 6 additions & 0 deletions internal/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,3 +447,9 @@ func (m *Repository) BookRoom(w http.ResponseWriter, r *http.Request) {

http.Redirect(w, r, "/make-reservation", http.StatusSeeOther)
}

func (m *Repository) ShowLogin(w http.ResponseWriter, r *http.Request) {
render.Template(w, r, "login.page.tmpl", &models.TemplateData{
Form: forms.New(nil),
})
}
4 changes: 2 additions & 2 deletions templates/login.page.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="col">
<h1>Login</h1>
<div class="form-group mt-3">
<label for="first_name">Email</label>
<label for="emial">Email</label>
{{with.Form.Errors.Get "email"}}
<label class="text-danger">{{.}}</label>
{{end}}
Expand All @@ -15,7 +15,7 @@
name='email' value="" required>
</div>
<div class="form-group">
<label for="first_name">Password</label>
<label for="password">Password</label>
{{with.Form.Errors.Get "password"}}
<label class="text-danger">{{.}}</label>
{{end}}
Expand Down

0 comments on commit d8e0c14

Please sign in to comment.