<?php
$root = ($this->getParam('root') !== 'disabled');
?>
<div class="zone medium"
    data-service="account.get"
    data-name="account"
    data-scope="console"
    data-event="load"
    data-success="redirect"
    data-success-param-redirect-url="/console"
    data-success-param-trigger-events="account.get">

    <div data-ls-if="{{account}} === undefined">
        <h1 class="zone xl margin-bottom-large margin-top">
            Sign In
        </h1>

        <div class="text-danger margin-bottom-large" data-ls-if="{{router.params.failure}} >= 1">Login failed. Please check your credentials.</div>

        <p>Login using email and password</p>

        <form name="account.createSession"
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="home"
            data-analytics-label="Create Account Session"
            data-service="account.createSession"
            data-scope="console"
            data-event="submit"
            data-success="trigger,hide,redirect"
            data-success-param-trigger-events="account.createSession"
            data-success-param-redirect-url="/console"
            data-failure="alert"
            data-failure-param-alert-text="Login failed. Please check your credentials."
            data-failure-param-alert-classname="error">

            <input name="email" type="email" class="full-width" autocomplete="email" placeholder="Email" required>

            <input name="password" type="password" class="full-width" autocomplete="off" placeholder="Password" required pattern=".{6,}" title="Six or more characters">

            <button>Sign In</button>
        </form>
        
        <br />
        <br />

        <div class="text-line-high-large text-align-center">
            <a href="/auth/recovery">Forgot password?</a><?php if(!$root): ?> or don't have an account? <b><a href="/auth/signup">Sign up now</a></b><?php endif; ?>
        </div>
    </div>
    
</div>