{% extends "layout.html" %}
{% from "_macros.html" import render_jquery_steps_header, render_field_with_errors, render_field, render_field_errors %}

{% block header %}
{{ render_jquery_steps_header() }}

<script>
  $( function() {

  var form = $("#main-form");
  form.validate();
});
</script>
{% endblock %}

{% block content %}

<h1>
  {{ _fsdomain('Login') }}
  {% if config["DOCS_URL"] %}
    <a class="btn btn-outline-info btn-sm m-1 my-auto float-right" href="{{ config["DOCS_URL"] }}/goto/user-login" target="_blank" rel="noopener noreferrer" role="button"><i class="fa fa-fw fa-info-circle"></i> {{ _('Docs') }}</a>
  {% endif %}
</h1>

{% set next = request.args['next'] if 'next' in request.args and 'authorize' in request.args['next'] else 'manage_after_login' %}
<form id="main-form" action="{{ url_for_security('login', next=next) }}" method="POST" name="login_user_form">
  {{ login_user_form.hidden_tag() }}
  {{ render_field_with_errors(login_user_form.email) }}
  {{ render_field_with_errors(login_user_form.password) }}

  <div class="form-group form-check">
    {{ login_user_form.remember(class="form-check-input")|safe }}
    <label class="form-check-label" for="remember">{{ _('Remember me') }}</label>
  </div>

  {{ render_field_errors(login_user_form.csrf_token) }}
  {{ render_field(login_user_form.submit) }}
</form>

<div class="card" class="my-4">
  <div class="card-body">
    <p class="card-text">{{ _('You do not have an account yet? Not a problem!') }}</p>
    <div class="my-2">
      <a href="{{ url_for_security('register') }}" class="btn btn-dark"><i class="fa fa-user-plus mr-2"></i> {{ _('Register for free') }}</a>
    </div>
  </div>
</div>

{% endblock %}
