misuzu/templates/auth/macros.twig

38 lines
1.4 KiB
Twig
Raw Normal View History

{% macro auth_login(username, message, is_welcome, redirect, autofocus) %}
{% set is_welcome = is_welcome|default(false) %}
{% set autofocus = autofocus|default(false) %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text %}
<form class="container auth js-login-form" method="post" action="/auth.php">
{{ input_hidden('auth[mode]', 'login') }}
{{ input_csrf('login') }}
{% if redirect|length > 0 %}
{{ input_hidden('auth[redirect]', redirect) }}
{% endif %}
<div class="auth__header">
2018-10-22 21:05:22 +00:00
<div class="auth__header__wrapper">
<div class="avatar auth__avatar js-login-avatar"
2018-10-22 21:05:22 +00:00
style="background-image:url('/profile.php?u=0&amp;m=avatar');"></div>
</div>
</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">
{{ 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) }}
<button class="input__button">Login</button>
</div>
</form>
{% endmacro %}