2023-01-31 12:07:17 +00:00
|
|
|
{{ define "title" -}}
|
|
|
|
{{( pgettext "Login" "title" )}}
|
|
|
|
{{- end }}
|
|
|
|
|
2023-01-22 20:41:50 +00:00
|
|
|
{{ define "content" }}
|
|
|
|
<h1><img src="/static/numerus.svg" alt="Numerus" width="620" height="77"></h1>
|
|
|
|
{{ if .LoginError -}}
|
|
|
|
<div class="error" role="alert">
|
|
|
|
<p>{{( gettext "Invalid user or password" )}}</p>
|
|
|
|
</div>
|
|
|
|
{{- end }}
|
|
|
|
<section id="login">
|
|
|
|
<h2>{{( pgettext "Login" "title" )}}</h2>
|
|
|
|
<form method="POST" action="/login">
|
2023-01-22 23:41:54 +00:00
|
|
|
<div class="input">
|
|
|
|
<input id="user_email" type="email" required autofocus name="email" autocapitalize="none" value="{{ .Email }}" placeholder="{{( pgettext "Email" "input" )}}">
|
|
|
|
<label for="user_email">{{( pgettext "Email" "input" )}}</label>
|
2023-01-30 15:52:13 +00:00
|
|
|
</div>
|
2023-01-17 21:28:47 +00:00
|
|
|
|
2023-01-22 23:41:54 +00:00
|
|
|
<div class="input">
|
|
|
|
<input id="user_password" type="password" required name="password" autocomplete="current-password" value="{{ .Password }}" placeholder="{{( pgettext "Password" "input" )}}">
|
|
|
|
<label for="user_password">{{( pgettext "Password" "input" )}}</label>
|
|
|
|
</div>
|
Implement login cookie, its verification, and logout
At first i thought that i would need to implement sessions, the ones
that keep small files onto the disk, to know which user is talking to
the server, but then i realized that, for now at least, i only need a
very large number, plus the email address, to be used as a lookup, and
that can be stored in the user table, in a separate schema.
Had to change login to avoid raising exceptions when login failed
because i now keep a record of login attemps, and functions are always
run in a single transaction, thus the exception would prevent me to
insert into login_attempt. Even if i use a separate procedure, i could
not keep the records.
I did not want to add a parameter to the logout function because i was
afraid that it could be called from separate users. I do not know
whether it is possible with the current approach, since the settings
variable is also set by the same applications; time will tell.
2023-01-17 19:48:50 +00:00
|
|
|
|
2023-01-22 20:41:50 +00:00
|
|
|
<button type="submit">{{( pgettext "Login" "action" )}}</button>
|
|
|
|
</form>
|
|
|
|
</section>
|
|
|
|
{{- end }}
|