mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
144 lines
5.3 KiB
Plaintext
144 lines
5.3 KiB
Plaintext
{% import "net/http" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
|
|
|
{% func RegisterHTML(rq *http.Request) %}
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<section>
|
|
{% if cfg.AllowRegistration %}
|
|
<form class="modal" method="post" action="/register?{%s rq.URL.RawQuery %}" id="register-form" enctype="multipart/form-data" autocomplete="off">
|
|
<fieldset class="modal__fieldset">
|
|
<legend class="modal__title">Register on {%s cfg.WikiName %}</legend>
|
|
|
|
<label for="register-form__username">Username</label>
|
|
<br>
|
|
<input type="text" required autofocus id="login-form__username" name="username">
|
|
<br>
|
|
<label for="login-form__password">Password</label>
|
|
<br>
|
|
<input type="password" required name="password">
|
|
<p>The server stores your password in an encrypted form; even administrators cannot read it.</p>
|
|
<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>
|
|
<input class="btn" type="submit" value="Register">
|
|
<a class="btn btn_weak" href="/{%s rq.URL.RawQuery %}">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
{%= telegramWidgetHTML() %}
|
|
{% elseif cfg.UseAuth %}
|
|
<p>Registrations are currently closed. Administrators can make an account for you by hand; contact them.</p>
|
|
<p><a href="/{%s rq.URL.RawQuery %}">← Go back</a></p>
|
|
{% else %}
|
|
<p>Authentication is disabled. You can make edits anonymously.</p>
|
|
<p><a href="/{%s rq.URL.RawQuery %}">← Go back</a></p>
|
|
{% endif %}
|
|
</section>
|
|
</main>
|
|
</div>
|
|
{% endfunc %}
|
|
|
|
{% func LoginHTML() %}
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<section>
|
|
{% if cfg.UseAuth %}
|
|
<form class="modal" method="post" action="/login-data" id="login-form" enctype="multipart/form-data" autocomplete="on">
|
|
<fieldset class="modal__fieldset">
|
|
<legend class="modal__title">Log in to {%s cfg.WikiName %}</legend>
|
|
<label for="login-form__username">Username</label>
|
|
<br>
|
|
<input type="text" required autofocus id="login-form__username" name="username" autocomplete="username">
|
|
<br>
|
|
<label for="login-form__password">Password</label>
|
|
<br>
|
|
<input type="password" required name="password" autocomplete="current-password">
|
|
<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>
|
|
<input class="btn" type="submit" value="Log in">
|
|
<a class="btn btn_weak" href="/">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
{%= telegramWidgetHTML() %}
|
|
{% else %}
|
|
<p>Authentication is disabled. You can make edits anonymously.</p>
|
|
<p><a class="btn btn_weak" href="/">← Go home</a></p>
|
|
{% endif %}
|
|
</section>
|
|
</main>
|
|
</div>
|
|
{% endfunc %}
|
|
|
|
Telegram auth widget was requested by Yogurt. As you can see, we don't offer user administrators control over it. Of course we don't.
|
|
{% func telegramWidgetHTML() %}
|
|
{% if cfg.TelegramEnabled %}
|
|
<p>You can log in using Telegram. It only works if you have set your @username in Telegram and this username is free on this wiki.</p>
|
|
<script async src="https://telegram.org/js/telegram-widget.js?15" data-telegram-login="{%s cfg.TelegramBotName %}" data-size="medium" data-userpic="false" data-auth-url="{%s cfg.URL %}/telegram-login"></script>
|
|
{% endif %}
|
|
{% endfunc %}
|
|
|
|
{% func LoginErrorHTML(err string) %}
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<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>
|
|
</div>
|
|
{% endfunc %}
|
|
|
|
{% func LogoutHTML(can bool) %}
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<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>
|
|
</div>
|
|
{% endfunc %}
|
|
|
|
{% func LockHTML() %}
|
|
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>🔒 Locked</title>
|
|
<link rel="shortcut icon" href="/static/favicon.ico">
|
|
<link rel="stylesheet" href="/static/style.css">
|
|
</head>
|
|
<body>
|
|
<main class="locked-notice">
|
|
<section class="locked-notice__message">
|
|
<p class="locked-notice__lock">🔒</p>
|
|
<h1 class="locked-notice__title">Locked</h1>
|
|
<form class="locked-notice__login-form" method="post" action="/login-data" id="login-form" enctype="multipart/form-data" autocomplete="on">
|
|
<label for="login-form__username">Username</label>
|
|
<br>
|
|
<input type="text" required autofocus id="login-form__username" name="username" autocomplete="username">
|
|
<br>
|
|
<label for="login-form__password">Password</label>
|
|
<br>
|
|
<input type="password" required name="password" autocomplete="current-password">
|
|
<br>
|
|
<input class="btn" type="submit" value="Log in">
|
|
</form>
|
|
</section>
|
|
</main>
|
|
</body>
|
|
</html>
|
|
{% endfunc %}
|