{% set title = 'Login' %}
{% set register_link = route('members-register', [], false) %}
{% set redirect = request.redirect %}
{% set forgotten_password_link = route('members-password-reminder', [], false) %}

{% if is_nhs_login is not empty %}
    {% set title = 'NHS prescriptions' %}
    {% set register_link = '/members/nhs/registration.php' %}
    {% set redirect = '/members/nhs/registration.php' %}
    {% set forgotten_password_link = route('members-password-reminder', {'nhs' : 1}, false) %}
{% endif %}



<div class="innerSidebar">

    <div class="sidebarIntro">

        {% if is_login_page is not empty %}
            <h1>{{ title }}</h1>
        {% else %}
            <h2>{{ title }}</h2>
        {% endif %}

        <p>Are you a member already? Use the form below to log in to your account.</p>


    </div><!-- .sidebarIntro -->

</div><!-- .innerSidebar -->

{% if errors is not empty and is_login_page is not empty %}
    <div class="error">
        <ul>
            {% for error in errors %}
                <li>{{error}}</li>
            {% endfor %}
        </ul>
    </div>
{% endif %}



<div class="memberLogin sidebarLogin">

    <form class="memberSignin js_memberSignin" method="post" action="{{ route('members-login-action', [], false) }}">

        <div class="row{% if errors.email %} inputError showError{% endif %}">
            <label for="loginEmail">Email</label>
            <div class="inputWrap">
                <input type="text" name="email" id="loginEmail" value="{{request.email}}" title="Email Address" class="text" />
            </div>
            {% if errors.email %}
                <div class="validationMessage">
                    {{ errors.email }}
                </div> <!-- .validationMessage -->
            {% endif %}
        </div>

        <div class="row{% if errors.password %} inputError showError{% endif %}">
            <label for="loginPassword">Password</label>
            <div class="inputWrap">
                <input type="password" name="password" id="loginPassword" value="" title="Password" class="text" />
            </div>
            {% if errors.password %}
                <div class="validationMessage">
                    {{ errors.password }}
                </div> <!-- .validationMessage -->
            {% endif %}

            <div class="assistiveLink">
                <a href="{{ forgotten_password_link }}">
                    Forgot password?
                </a>
            </div> <!-- .assistiveLink -->
        </div>

        <div class="loginSubmitFooter">
            <button
                    type="submit"
                    name="submitbtn"
                    class="buttonAlt">Login</button>

        </div> <!-- .loginSubmitFooter -->


        <input type="hidden" value="login" name="action" />
        <input type="hidden" name="redirect" value="{{ redirect }}" />


    </form>

</div> <!-- .memberLogin -->
