🩹 Better response when not eligible to vote
This commit is contained in:
parent
8f3a5b35c8
commit
ff83e9abce
2 changed files with 20 additions and 1 deletions
|
@ -137,7 +137,7 @@ func handleShowVoting(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
if v.Deadline().After(time.Now().UTC()) {
|
if v.Deadline().After(time.Now().UTC()) {
|
||||||
if !eligible(ctx.Request().Header.Get("X-Remote-User"), v.Electors()) {
|
if !eligible(ctx.Request().Header.Get("X-Remote-User"), v.Electors()) {
|
||||||
return ctx.String(http.StatusForbidden, "")
|
return ctx.Render(http.StatusOK, "not_eligible", nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ctx.Render(http.StatusOK, "voting", map[string]interface{}{
|
return ctx.Render(http.StatusOK, "voting", map[string]interface{}{
|
||||||
|
|
19
tmpl/not_eligible.html
Normal file
19
tmpl/not_eligible.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{{ define "not_eligible" }}
|
||||||
|
{{ template "head" . }}
|
||||||
|
<div class="flex flex-col justify-center align-center items-center h-screen bg-slate-900 p-2">
|
||||||
|
<div class="w-full md:w-3/4 lg:w-1/2 xl:w-1/3 border rounded-lg p-2 sm:p-6 md:p-8 bg-slate-800 border-purple-900 text-white">
|
||||||
|
<div class="relative sm:rounded-lg">
|
||||||
|
<h1 class="text-center text-4xl text-white pb-2">
|
||||||
|
Not eligible!
|
||||||
|
</h1>
|
||||||
|
<p class="p-4 text-gray-400 text-center">
|
||||||
|
Sorry, you are not eligible to vote
|
||||||
|
</p>
|
||||||
|
<form action="/v" method="GET">
|
||||||
|
<button type="submit" class="w-full hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center bg-purple-600 hover:bg-purple-700 focus:ring-blue-800 text-white hover:text-yellow-200 text-xl">Go back</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ template "tail" . }}
|
||||||
|
{{ end }}
|
Loading…
Reference in a new issue