{% form_theme form 'bootstrap_4_layout.html.twig' %}
{% import "@CoreShopFrontend/Common/Macro/messages.html.twig" as messages %}

<div class="row">
    <div class="col-sm-6">
        <div class="card card-smart">
            <div class="card-header">
                <h3 class="card-title">{{ 'coreshop.ui.login'|trans }}</h3>
            </div>
            <div class="card-body">
                {% if last_error %}
                    {{ messages.error(last_error.messageKey|trans(last_error.messageData, 'security')) }}
                {% endif %}
                <p>
                    {{ 'coreshop.ui.login_with_existing_account'|trans }}
                </p>

                {{ form_start(form, {'action': path('coreshop_login_check'), 'attr': {'novalidate': 'novalidate'}}) }}

                    {{ form_row(form._username, coreshop_test_form_attribute('login-username')) }}
                    {{ form_row(form._password, coreshop_test_form_attribute('login-password')) }}
                    {{ form_row(form._remember_me, coreshop_test_form_attribute('remember-me')) }}

                    {% if target is defined and target %}
                        <input type="hidden" name="_target_path" value="{{ target }}" />
                    {% endif %}

                    {% if failure is defined and failure %}
                        <input type="hidden" name="_failure_path" value="{{ failure }}" />
                    {% endif %}

                    <button type="submit" class="btn-success btn submit button" {{ coreshop_test_html_attribute('login-button') }}>{{ 'coreshop.ui.login'|trans }}</button>

                    <a class="pull-right" href="{{ path('coreshop_customer_password_reset_request') }}">{{ 'coreshop.ui.reset_password'|trans }}</a>
                {{ form_end(form, {'render_rest': false}) }}
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="card card-smart">
            <div class="card-header">
                <h3 class="card-title">{{ 'coreshop.ui.create_new_account'|trans }}</h3>
            </div>
            <div class="card-body">
                <p>
                    {{ 'coreshop.ui.registration_text'|trans }}
                </p>
                <a href="{{ path('coreshop_register', {'_redirect': target}) }}" class="btn btn-success">{{ 'coreshop.ui.register'|trans }}</a>
            </div>
        </div>
    </div>
</div>
