feat: Add error message on login page

This commit is contained in:
ptrcnull 2021-10-05 13:54:37 +02:00
parent f3c719928f
commit 56df02bbe6
2 changed files with 9 additions and 4 deletions

View file

@ -59,7 +59,7 @@ func (m *Module) Init(mm *modweb.ModuleManager) {
user.Save(session) user.Save(session)
} }
return ctx.Redirect("/") return mm.Render(ctx, "partials/login-form", fiber.Map{"error": "Invalid username or password"})
}) })
} }

View file

@ -1,14 +1,19 @@
{{ if .error -}}
<article class="message is-danger">
<div class="message-body">{{ .error }}</div>
</article>
{{- end }}
<form action="/login/" method="POST"> <form action="/login/" method="POST">
<div class="field"> <div class="field">
<label for="login" class="label">Username</label> <label for="username" class="label">Username</label>
<div class="control"> <div class="control">
<input type="text" name="username" class="input" required=""> <input type="text" name="username" id="username" class="input" required="">
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label for="password" class="label">Password</label> <label for="password" class="label">Password</label>
<div class="control"> <div class="control">
<input type="password" name="password" class="input" placeholder="********" required=""> <input type="password" name="password" id="password" class="input" placeholder="********" required="">
</div> </div>
</div> </div>
<div class="control"> <div class="control">