{% extends "users/layout.html" %}
{% block users_nav %}<a href="{{url_for('.signup')}}">{{_("Create an account")}}</a>{% endblock %}
{% block users_content %}
  <form action="" method="post" class="login-form" id="login-form">
    {{ form.hidden_tag() }}
    <h2>{{_("Login to your account")}}</h2>
    <div class="form-group">
      <label for="identifier" class="form-label">{{form.identifier.label.text}}</label>
      {{ form.identifier(class_="form-control form-control-lg") }}
    </div>
    <div class="form-group">
      <label for="password" class="form-label">{{form.password.label.text}}</label>
      {{ form.password(class_="form-control form-control-lg") }}
    </div>
    <div class="d-flex align-items-center mb-3">
      <div class="flex-fill">
        <label>{{ form.remember() }} {{form.remember.label.text}}</label>
      </div>
      {% if app.extensions.frasco_users.options['allow_reset_password'] %}
      <div>
        <a href="{{ url_for('users.send_reset_password') }}">{{ _("Password lost?") }}</a>
      </div>
      {% endif %}
    </div>
    <button type="submit" class="btn btn-primary btn-lg" onclick="trackLogin()">{{_("Login")}}</button>
    {% include "users/_external_auth.html" %}
    {% include "users/_sso_link.html" %}
  </form>
  <script type="text/javascript">
    function trackLogin() {
      {% if app.config['GOOGLE_ANALYTICS_ID'] %}
      ga('send', 'event', 'account', 'login', 'saas');
      {% endif %}
      {% if app.config['PLAUSIBLE_URL'] %}
      plausible('login');
      {% endif %}
    }
  </script>
{% endblock %}

{% block footer %}
  {{ super() }}
  {% include "users/_tracking_scripts.html" %}
{% endblock %}
