misuzu/templates/auth/auth.twig

75 lines
3.5 KiB
Twig

{% extends 'auth/master.twig' %}
{% from 'macros.twig' import container_title %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text %}
{% from 'auth/macros.twig' import auth_login %}
{% block content %}
{{ auth_login(
auth_username|default(''),
auth_register_message|default(auth_login_error|default('')),
auth_register_message is defined,
auth_redirect|default('/'),
auth_mode == 'login'
) }}
{% if can_create_account %}
<form class="container auth" method="post" action="">
{{ input_hidden('auth[mode]', 'register') }}
{{ input_csrf('register') }}
{{ container_title('<i class="fas fa-user-check fa-fw"></i> Register') }}
{% if auth_restricted %}
<div class="warning auth__warning">
<div class="warning__content">
{% if auth_restricted == 2 %}
A user is currently in a banned and/or silenced state from the same IP address you're currently visiting the site from. If said user isn't you and you wish to create an account, please <a href="/info.php/contact" class="warning__link">contact us</a>!
{% else %}
The IP address from which you are visiting the website appears on our blacklist, you are not allowed to register from this address but if you already have an account you can log in just fine using the form above. If you think this blacklisting is a mistake, please <a href="/info.php/contact" class="warning__link">contact us</a>!
{% endif %}
</div>
</div>
{% else %}
{% if auth_register_error is defined %}
<div class="warning auth__warning">
<div class="warning__content">
{{ auth_register_error }}
</div>
</div>
{% endif %}
<div class="auth__form">
{{ input_text('auth[username]', 'auth__input', auth_username|default(''), 'text', 'Username', true, null, 0, auth_mode == 'register') }}
{{ input_text('auth[password]', 'auth__input', '', 'password', 'Password', true) }}
{{ input_text('auth[email]', 'auth__input', auth_email|default(''), 'text', 'E-mail', true) }}
{{ input_text('auth[meow]', 'auth__input', '', 'text', 'What is the outcome of nine plus ten?', true) }}
<button class="input__button">Create your account</button>
</div>
{% endif %}
</form>
{% endif %}
{% if can_reset_password %}
<form class="container auth" method="post" action="">
{{ input_hidden('auth[mode]', 'forgot') }}
{{ input_csrf('passforgot') }}
{{ container_title('<i class="fas fa-user-lock fa-fw"></i> Forgot password') }}
{% if auth_forgot_error is defined %}
<div class="warning auth__warning">
<div class="warning__content">
{{ auth_forgot_error }}
</div>
</div>
{% endif %}
<div class="auth__form">
{{ input_text('auth[email]', 'auth__input', auth_email|default(''), 'text', 'E-mail', true, null, 0, auth_mode == 'forgot') }}
<button class="input__button">Send reminder</button>
</div>
</form>
{% endif %}
{% endblock %}