create login page

This commit is contained in:
vinchent 2024-08-12 21:38:12 +02:00
parent 4dfb28ad3d
commit 846282db74
4 changed files with 52 additions and 0 deletions

View File

@ -283,3 +283,9 @@ func (app *application) BronzePlanReceipt(w http.ResponseWriter, r *http.Request
app.errorLog.Println(err) 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)
}
}

View File

@ -22,6 +22,9 @@ func (app *application) routes() http.Handler {
mux.Get("/plans/bronze", app.BronzePlan) mux.Get("/plans/bronze", app.BronzePlan)
mux.Get("/receipt/bronze", app.BronzePlanReceipt) mux.Get("/receipt/bronze", app.BronzePlanReceipt)
// auth routes
mux.Get("/login", app.LoginPage)
fileServer := http.FileServer(http.Dir("./static")) fileServer := http.FileServer(http.Dir("./static"))
mux.Handle("/static/*", http.StripPrefix("/static", fileServer)) mux.Handle("/static/*", http.StripPrefix("/static", fileServer))

View File

@ -51,6 +51,11 @@
</ul> </ul>
</li> </li>
</ul> </ul>
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a href="/login" class="nav-link">Login</a>
</li>
</ul>
</div> </div>
</div> </div>
</nav> </nav>

View File

@ -0,0 +1,38 @@
{{ template "base" . }}
{{ define "title" }}
Login
{{ end }}
{{ define "content" }}
<form action=""
method="post"
name=""
id=""
class="d-blick needs-validation"
autocomplete="off"
novalidate="">
<h2 class="mt-2 mb-3 text-center">Login</h2>
<hr>
<div class="mb-3">
<label for="-email" class="form-label">Email</label>
<input type="text"
id="email"
name="email"
autocomplete="email-new"
required=""
class="form-control">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="text"
id="password"
name="password"
autocomplete="password-new"
required=""
class="form-control">
</div>
<hr>
<a href="javascript:void(0)" class="btn btn-primary">Login</a>
</form>
{{ end }}
{{define "js"}}
{{end}}