2018-12-01 11:39:47 +00:00
|
|
|
{% macro auth_login(username, message, is_welcome, redirect, autofocus) %}
|
2018-09-27 22:27:30 +00:00
|
|
|
{% set is_welcome = is_welcome|default(false) %}
|
2018-12-01 11:39:47 +00:00
|
|
|
{% set autofocus = autofocus|default(false) %}
|
2018-09-27 22:27:30 +00:00
|
|
|
|
2018-10-25 01:35:53 +00:00
|
|
|
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text %}
|
|
|
|
|
2018-11-15 22:02:57 +00:00
|
|
|
<form class="container auth js-login-form" method="post" action="/auth.php">
|
2018-10-25 01:35:53 +00:00
|
|
|
{{ input_hidden('auth[mode]', 'login') }}
|
|
|
|
{{ input_csrf('login') }}
|
2018-09-27 22:27:30 +00:00
|
|
|
|
2018-12-01 11:39:47 +00:00
|
|
|
{% if redirect|length > 0 %}
|
|
|
|
{{ input_hidden('auth[redirect]', redirect) }}
|
|
|
|
{% endif %}
|
|
|
|
|
2019-01-03 18:02:38 +00:00
|
|
|
<div class="container__title">
|
|
|
|
<div class="container__title__background"></div>
|
|
|
|
<div class="auth__header">
|
|
|
|
<div class="avatar auth__avatar js-login-avatar" style="background-image:url('/profile.php?u=0&m=avatar');"></div>
|
2018-10-22 21:05:22 +00:00
|
|
|
</div>
|
2018-09-27 22:27:30 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if message|length > 0 %}
|
|
|
|
<div class="warning auth__warning{% if is_welcome %} auth__warning--welcome{% endif %}">
|
|
|
|
<div class="warning__content">
|
|
|
|
{{ message }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="auth__form">
|
2018-12-01 11:39:47 +00:00
|
|
|
{{ input_text('auth[username]', 'auth__input js-login-username', username|default(''), 'text', 'Username', true, null, 0, autofocus) }}
|
|
|
|
{{ input_text('auth[password]', 'auth__input', '', 'password', 'Password', true, null) }}
|
2018-09-27 22:27:30 +00:00
|
|
|
|
2018-12-27 02:59:57 +00:00
|
|
|
<button class="input__button">Log in</button>
|
2018-09-27 22:27:30 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{% endmacro %}
|