{% extends "main.html" %}
{% block title %}{{ _("Spam check in progress") }}{% endblock %}

{% block content %}
  {{ super() }}

  <div class="container py-4">
    <div class="row">
      <div class="col-6 mx-auto">
        <div class="alert alert-{% if user.status_note == 'spamcheck_denied' %}warning{% else %}info{% endif %}" role="alert">
          {% if user.status_note == "spamcheck_awaiting" %}
            <h4 class="alert-heading">
              {{ _("Your account is being checked") }}
            </h4>
            <p>{{_("Before you can log in, your account needs to be check for spam likelihood. It should only take a few seconds, please wait...")}}</p>
          {% elif user.status_note == "spamcheck_manual" %}
            <h4 class="alert-heading">
              {{ _("Your account requires admin approval") }}
            </h4>
            <p>
              {{ _("Your account needs to be approved by an administrator.") }}
              {{ _("You will receive an email when the decision has been taken.") }}
              {{ _("Thank you for your patience.") }}
              {% if spamcheck_contact is defined %}
                {{ spamcheck_contact() }}
              {% endif %}
            </p>
          {% elif user.status_note == "spamcheck_denied" %}
            <h4 class="alert-heading">
              {{ _("Your account is blocked") }}
            </h4>
            <p class="mb-1">{{ _("Your account has been flagged as spam.") }}</p>
            {% if spamcheck_contact is defined %}
              {{ spamcheck_contact() }}
            {% endif %}
          {% else %}
            <h4 class="alert-heading">
              {{ _("Something went wrong") }}
            </h4>
            <p>
              {{ _("Unsupported spam status: %s, please contact the administrators", user.status_note) }}
            </p>
          {% endif %}
        </div>
      </div>
    </div> <!-- ./row -->
  </div>

  {% if user.status_note == "spamcheck_awaiting" %}
    <script nonce="{{ csp_nonce() }}">
      // refresh page every five seconds
      setTimeout(function(){ location.reload(); }, 5000);
    </script>
  {% endif %}

{% endblock %}
