<!-- extend base layout -->
{% extends "appbuilder/base.html" %}

{% block content %}

<script type="text/javascript">
function set_openid(openid, pr)
{
    u = openid.search('<username>');
    if (u != -1) {
        // openid requires username
        user = prompt('Enter your ' + pr + ' username:');
        openid = openid.substr(0, u) + user;
    }
    form = document.forms['login'];
    form.elements['openid'].value = openid;
}
</script>


<div class="container">
        <div id="loginbox" style="margin-top:50px;" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
            <div class="panel panel-primary" >
                    <div class="panel-heading">
                        <div class="panel-title">{{ title }}</div>
                    </div>
                    <div style="padding-top:30px" class="panel-body" >

    <form class="form" action="" method="post" name="login">
        {{form.hidden_tag()}}
        <div class="help-block">{{_("Click on your OpenID provider below")}}:</div>
        <div class="control-group">
            {% for pr in providers %}
            <a href="javascript:set_openid('{{pr.url}}', '{{pr.name}}');"><img src="{{url_for('appbuilder.static',filename='img/' + pr.name.lower() + '.png')}}" class="img-polaroid" style="margin:2px;" /></a>
            {% endfor %}
        </div>
        <div class="control-group{% if form.errors.openid %} error{% endif %}">
            <label class="control-label" for="openid">{{_("Or enter your OpenID here")}}:</label>
            <div class="controls">
                {{ form.openid(size = 80, class = "form-control") }}
                {% for error in form.errors.openid %}
                    <span class="help-inline">[{{error}}]</span><br>
                {% endfor %}
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <label class="checkbox" for="remember_me">
                    {{ form.remember_me }} Remember Me
                </label>
            </div>
        </div>
                <input class="btn btn-primary btn-block" type="submit" value={{_('Sign In')}}>
    </form>
</div>
</div></div></div>
{% endblock %}
