1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/templates/auth.qtpl

61 lines
1.7 KiB
Plaintext
Raw Normal View History

2020-11-14 10:39:18 +00:00
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% func LoginHTML() %}
<main>
<section>
{% if user.AuthUsed %}
<h1>Login</h1>
<form method="post" action="/login-data" id="login-form" enctype="multipart/form-data">
<p>Use the data you were given by an administrator.</p>
2020-11-14 10:39:18 +00:00
<fieldset>
<legend>Username</legend>
<input type="text" required autofocus name="username" autocomplete="on">
</fieldset>
<fieldset>
<legend>Password</legend>
<input type="password" required name="password" autocomplete="on">
</fieldset>
<p>By submitting this form you give this wiki a permission to store cookies in your browser. It lets the engine associate your edits with you. You will stay logged in until you log out.</p>
2020-11-14 10:39:18 +00:00
<input type="submit">
<a href="/">Cancel</a>
</form>
{% else %}
<p>Administrator of this wiki have not configured any authorization method. You can make edits anonymously.</p>
<p><a href="/">← Go home</a></p>
{% endif %}
</section>
</main>
{% endfunc %}
{% func LoginErrorHTML(err string) %}
<main>
<section>
{% switch err %}
{% case "unknown username" %}
<p class="error">Unknown username.</p>
{% case "wrong password" %}
<p class="error">Wrong password.</p>
{% default %}
<p class="error">{%s err %}</p>
{% endswitch %}
<p><a href="/login">← Try again</a></p>
</section>
</main>
{% endfunc %}
2020-11-14 13:03:06 +00:00
{% func LogoutHTML(can bool) %}
<main>
<section>
{% if can %}
<h1>Log out?</h1>
<p><a href="/logout-confirm"><strong>Confirm</strong></a></p>
<p><a href="/">Cancel</a></p>
{% else %}
<p>You cannot log out because you are not logged in.</p>
<p><a href="/login">Login</a></p>
<p><a href="/login">← Home</a></p>
{% endif %}
</section>
</main>
{% endfunc %}