## -*- coding: utf-8 -*-
## (c) 2014-2016 Andreas Motl, Elmyra UG

<%inherit file="site.mako" />

<%block name="application">

<style type="text/css">
    body {
        background-image: url("/static/img/login-background.jpg");
        background-repeat: no-repeat;
        background-position: top;
    }
</style>

<script type="application/javascript">
    var login_settings = {
        vendorname: '${theme['ui.vendor.name']}',
        productname: '${theme['ui.productname']}',
        username: '${username}',
        support_email: '${theme['ui.email.support']}',
    };
</script>

<!-- Application bundle -->
% if h.development_mode():
<script type="text/javascript" src="/static/assets/commons.bundle.js"></script>
<script type="text/javascript" src="/static/assets/app-login.bundle.js"></script>
% else:
<script type="text/javascript" src="/static/assets/commons.bundle.min.js"></script>
<script type="text/javascript" src="/static/assets/app-login.bundle.min.js"></script>
% endif


<div class="login-modal">

## login form
<div class="login-box container-fluid">

    <form class="form-signin" method="post" action="/auth">

        <div class="row-fluid">

            <div class="span12">
                <h3 class="form-signin-heading-logo text-center">${theme['ui.productname.login'] | n}</h3>
                <h2 class="form-signin-heading">Please sign in</h2>
                <input name="username" type="text" class="input-block-level" placeholder="Email address" value="${username}" autofocus="autofocus" />
                <input name="password" type="password" class="input-block-level" placeholder="Password" />
                <input name="came_from" type="hidden" value="${came_from}" />
                <!--
                <label class="checkbox">
                    <input type="checkbox" value="remember-me"> Remember me
                </label>
                -->
            </div>

        </div>

        <div class="row-fluid">
            <div class="span6">
                <button class="btn btn-large btn-primary" type="submit"><i class="icon-signin"></i> &nbsp; Sign in</button>
            </div>
            <div class="span6">
                <a class="btn btn-large pull-right" id="mail-register" href="mailto:${theme['ui.email.purchase'] | n}" role="button">Register</a>
            </div>
        </div>

        <div class="row-fluid">
            <div class="span12">
                % if error == True:

                <%
                kind = 'error'
                if reason == 'login-failed':
                    message = 'Please check your credentials or '

                elif reason == 'login-disabled':
                    message = 'Your account is disabled or not approved yet. If you think this is wrong, please '
                    kind = 'warning'

                else:
                    message = 'We could not determine why your login failed. Please '
                %>

                <br/>
                <div class="alert alert-${kind} alert-block">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <h4>Login failed</h4>
                    <br/>
                    ${message}
                    <a id="mail-login-failed" href="mailto:${theme['ui.email.support'] | n}">contact us for support</a>.
                </div>
                % endif
            </div>
        </div>

        <div class="row-fluid">
            <div class="span12">
                <div class="alert alert-success alert-block">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    You are welcome to register for a 14 day trial account.
                    <br/><br/>
                    Otherwise, please take a glimpse into a <a id="visit-demo" href="/" target="_blank">demo query</a>,
                    feel free to explore and drill down further.
                </div>
            </div>
        </div>

        <div class="row-fluid">
            <div class="span12">
                <hr class="clear-margin" style="margin-top: 10px"/>
                <div class="page-footer pull-left">
                    ${theme['ui.vendor.copyright'] | n}
                </div>
            </div>
        </div>

    </form>

</div> <!-- /container -->

</div>

<div class="modal-backdrop fade in"></div>


<script type="text/x-underscore-template" id="template-mail-register">
<%text>
Dear <%= vendorname %> support team,

please register a new account for accessing the <%= productname %>
on domain "<%= domain %>" using the provided email address as my username.

Thank you in advance, looking forward to hearing from you soon.

With kind regards,

</%text>
</script>

<script type="text/x-underscore-template" id="template-mail-login-failed">
<%text>
Dear <%= vendorname %> support team,

i tried to login into my account "<%= username %>" on domain "<%= domain %>"
multiple times without success. Please get back to me to clear things up.

Thank you in advance, looking forward to hearing from you soon.

With kind regards,

</%text>
</script>

</%block>
