+login form

This commit is contained in:
Simon Martens
2025-05-21 17:28:42 +02:00
parent 8bf7b6fb84
commit 9642e53474
6 changed files with 92 additions and 7 deletions

View File

@@ -33,4 +33,6 @@ const (
F_INDEX_TEXTE_ABS1 = "Abs1"
F_INDEX_TEXTE_ABS2 = "Abs2"
F_INDEX_GO_BUTTON = "GoButton"
P_LOGIN_NAME = "login"
)

View File

@@ -8,6 +8,7 @@ import (
func init() {
RegisterStaticPage("/datenschutz/", pagemodels.P_DATENSCHUTZ_NAME)
RegisterStaticPage("/login/", pagemodels.P_LOGIN_NAME, "blank")
RegisterTextPage("/redaktion/kontakt/", pagemodels.P_KONTAKT_NAME)
RegisterTextPage("/redaktion/danksagungen/", pagemodels.P_DANK_NAME)
RegisterTextPage("/redaktion/literatur/", pagemodels.P_LIT_NAME)
@@ -16,29 +17,44 @@ func init() {
RegisterTextPage("/redaktion/lesekabinett/", pagemodels.P_KABINETT_NAME)
}
func RegisterStaticPage(url, name string) {
func RegisterStaticPage(url, name string, layout ...string) {
layoutName := templating.DEFAULT_LAYOUT_NAME
if len(layout) > 0 {
layoutName = layout[0]
}
app.Register(&pagemodels.StaticPage{
Name: name,
Layout: templating.DEFAULT_LAYOUT_NAME,
Layout: layoutName,
Template: url,
URL: url,
})
}
// TODO: mocve textpage to defaultpage with T = TextPageRecord
func RegisterTextPage(url, name string) {
func RegisterTextPage(url, name string, layout ...string) {
layoutName := templating.DEFAULT_LAYOUT_NAME
if len(layout) > 0 {
layoutName = layout[0]
}
app.Register(&pagemodels.TextPage{
Name: name,
Layout: templating.DEFAULT_LAYOUT_NAME,
Layout: layoutName,
Template: url,
URL: url,
})
}
func RegisterDefaultPage(url string, name string) {
func RegisterDefaultPage(url string, name string, layout ...string) {
layoutName := templating.DEFAULT_LAYOUT_NAME
if len(layout) > 0 {
layoutName = layout[0]
}
app.Register(&pagemodels.DefaultPage[*pagemodels.DefaultPageRecord]{
Name: name,
Layout: templating.DEFAULT_LAYOUT_NAME,
Layout: layoutName,
Template: url,
URL: url,
Record: &pagemodels.DefaultPageRecord{},

File diff suppressed because one or more lines are too long

View File

@@ -17,6 +17,9 @@
<span>&middot;</span>
<i class="ri-code-line"></i>
<a href="https://github.com/Theodor-Springmann-Stiftung/musenalm">Code</a>
<span>&middot;</span>
<i class="ri-login-box-line"></i>
<a href="/login">Login</a>
</div>
</div>
</footer>

View File

@@ -0,0 +1,63 @@
<div class="flex max-w-md mx-auto !pt-44">
<div class="flex-col w-full">
<a href="/" class="text-gray-700 hover:text-slate-950">
<i class="ri-arrow-left-s-line"></i> Startseite
</a>
<div class="flex justify-center mt-8 items-baseline">
<div>
<img class="h-20 w-20 border" src="/assets/favicon.png" />
</div>
</div>
<h1 class="text-4xl self-baseline text-center w-full mt-6">Musenalm | Login</h1>
<form class="mt-9 w-full grid grid-cols-3 gap-4" method="POST" action="/login">
<div
class="col-span-3 border-2 border-transparent focus-within:border-slate-600 px-2 py-1 pb-1.5
bg-slate-200 focus-within:bg-slate-50 rounded-md transition-all duration-100">
<label for="username" class="text-sm text-gray-700 font-bold">
E-Mail <i class="ri-at-line"></i>
</label>
<input
type="text"
name="username"
id="username"
class="mt-1 block w-full rounded-md focus:border-none focus:outline-none"
placeholder=""
required
autocomplete="username"
value=""
autofocus />
</div>
<div
class="col-span-3 border-2 border-transparent focus-within:border-slate-600 px-2 py-1 pb-1.5
bg-slate-200 focus-within:bg-slate-50 rounded-md transition-all duration-100">
<label for="password" class="text-sm text-gray-700 font-bold">
Passwort <i class="ri-key-2-line"></i>
</label>
<input
type="password"
name="password"
id="password"
class="mt-1 block w-full rounded-md focus:border-none focus:outline-none"
placeholder=""
required
autocomplete="current-password" />
</div>
<div class="col-span-3">
<button
type="submit"
class="w-full inline-flex justify-center py-2 px-4 border border-transparent rounded-md
shadow-sm text-sm font-medium text-white bg-slate-700 hover:bg-slate-800 cursor-pointer focus:outline-none
focus:ring-2 focus:ring-offset-2 focus:ring-slate-500">
Einloggen
</button>
</div>
<!--
<div class="col-span-3">
<a href="/forgot-password" class="text-sm text-slate-600 hover:text-slate-900">
Passwort vergessen?
</a>
</div>
-->
</form>
</div>
</div>

View File

@@ -0,0 +1 @@
<title>Musenalm &ndash; Login</title>