{# -*- coding: utf-8 -*-

  This file is part of Invenio.
  Copyright (C) 2015-2018 CERN.
  Copyright (C)      2021 TU Wien.

  Invenio is free software; you can redistribute it and/or modify it
  under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends config.ACCOUNTS_COVER_TEMPLATE %}

{% from "invenio_accounts/_macros.html" import render_field, form_errors %}

{% block panel %}
<div class="col-md-6 col-md-offset-3">
  <div class="panel panel-default">
    <div class="panel-body">
      {%- block form_header %}
      <h3 class="text-center panel-free-title">{{_('Log in to account') }}</h3>
      {%- endblock form_header %}
      {%- block form_outer %}
      {%- if config.ACCOUNTS_LOCAL_LOGIN_ENABLED %}
      {%- with form = login_user_form %}
      <form action="{{ url_for_security('login') }}" method="POST" name="login_user_form">
      {{form.hidden_tag()}}
      {{form_errors(form)}}
      {{ render_field(form.email, icon="fa fa-user", autofocus=True, errormsg=False) }}
      {{ render_field(form.password, icon="fa fa-lock", errormsg=False) }}
      <button type="submit" class="btn btn-primary btn-lg btn-block"><i class="fa fa-sign-in"></i> {{_('Log in')}}</button>
      </form>
      {%- endwith %}
      {%- endif %}
      {%- endblock form_outer %}
    </div>
    {%- block registerable %}
    {%- if security.registerable %}
    <div class="panel-footer text-center">
        <h4 class="text-muted">{% trans sitename=config.ACCOUNTS_SITENAME %}New to {{sitename}}?{% endtrans %} <a href="{{url_for('security.register')}}">{{_('Sign up')}}</a></h4>
    </div>
    {%- endif %}
    {%- endblock %}
  </div>
  {%- block recoverable %}
  {%- if security.recoverable %}
  <a href="{{url_for('security.forgot_password')}}" class="text-muted">{{_('Forgot password?')}}</a>
  {%- endif %}
  {%- endblock %}
</div>
{% endblock panel %}
