{% extends "base-site.html" %}

{% block title %} {{ _('Login') }} {% endblock %}

<!-- Specific Page CSS goes HERE  -->
{% block stylesheets %}{% endblock stylesheets %}

{% block content %}

<div class="row">
  <div class="col-md-8">
    <div class="card">
      {% if status == '0' %}
      <div class="card-header">
        <h1 class="title">{{ _('Login') }}</h1>
      </div>
      {% if redirect %}
      <div class="card-body">
        <div class="row">
          <div class="col-1 px-md-1"></div>
          <div class="col-md-11 px-md-1">
            <h5>
              {{ _('Welcome to the Red Discord Bot dashboard! A lot of the magic here is hidden behind authorization. Want to see some of it? Login with Discord below!') }}
            </h5>
          </div>
        </div>
      </div>
      <div class="card-footer">
        <a
          href="https://discord.com/api/oauth2/authorize?client_id={{ clientid }}&redirect_uri={{ redirect }}&response_type=code&scope=identify"><button
            class="btn">{{ _('Login with Discord') }}</button></a><br>
        {{ _('By clicking the button above, you acknowledge that you have read and agree to our Privacy Policy found <a href="{link}" target="_blank">here</a>.').format(link="https://github.com/Cog-Creators/Red-Dashboard/blob/master/documents/Privacy%20Policy.md") }}
      </div>
      {% else %}
      <div class="card-body">
        <div class="row">
          <div class="col-md-1 px-md-1"></div>
          <div class="col-md-11 px-md-1">
            <h5>
              {{ _('Welcome to the Red Discord Bot dashboard! A lot of the magic here is hidden behind authorization, but unfortunately, login is currently not available because the dashboard is not connected to any bot.') }}
            </h5>
          </div>
        </div>
      </div>
      {% endif %}
      {% elif status == '1' %}
      <div class="card-header">
        <h1 class="title">{{ _('Login Failed') }}</h1>
      </div>
      {% if redirect %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>{{ _('Looks like you denied authorization. Made a mistake? Click the button below to try again.') }}</h5>
        </div>
      </div>
      <div class="card-footer">
        <a
          href="https://discord.com/api/oauth2/authorize?client_id={{ clientid }}&redirect_uri={{ redirect }}&response_type=code&scope=identify"><button
            class="btn">{{ _('Login with Discord') }}</button></a><br>
        {{ _('By clicking the button above, you acknowledge that you have read and agree to our Privacy Policy found <a href="{link}" target="_blank">here</a>.').format(link="https://github.com/Cog-Creators/Red-Dashboard/blob/master/documents/Privacy%20Policy.md") }}
      </div>
      {% else %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>
            {{ _("Looks like you denied authorization. Unfortunately, the dashboard's connection to the bot has terminated. Check back later.") }}
          </h5>
        </div>
      </div>
      {% endif %}
      {% elif status == '2' %}
      <div class="card-header">
        <h1 class="title">{{ _('Login Failed') }}</h1>
      </div>
      {% if redirect %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>
            {{ _('Looks like the bot owner may have not configured the dashboard properly. You can try again below if you believe this was a fluke. If this happens multiple times, please let the bot owner or server owner know.') }}
          </h5>
        </div>
      </div>
      <div class="card-footer">
        <a
          href="https://discord.com/api/oauth2/authorize?client_id={{ clientid }}&redirect_uri={{ redirect }}&response_type=code&scope=identify"><button
            class="btn">{{ _('Login with Discord') }}</button></a><br>
        {{ _('By clicking the button above, you acknowledge that you have read and agree to our Privacy Policy found <a href="{link}" target="_blank">here</a>.').format(link="https://github.com/Cog-Creators/Red-Dashboard/blob/master/documents/Privacy%20Policy.md") }}
      </div>
      {% else %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>
            {{ _("Looks like the bot owner may have not configured the dashboard properly. Unfortunately, the dashboard's connection to the bot has terminated. Check back later.") }}
          </h5>
        </div>
      </div>
      {% endif %}
      {% elif status == '3' %}
      <div class="card-header">
        <h1 class="title">{{ _('Login Failed') }}</h1>
      </div>
      {% if redirect %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>
            {{ _("Looks like something went wrong on Discord's end. Try to login again below, or check to see if Discord is having API issues.") }}
          </h5>
        </div>
      </div>
      <div class="card-footer">
        <a
          href="https://discord.com/api/oauth2/authorize?client_id={{ clientid }}&redirect_uri={{ redirect }}&response_type=code&scope=identify"><button
            class="btn">{{ _('Login with Discord') }}</button></a><br>
        {{ _('By clicking the button above, you acknowledge that you have read and agree to our Privacy Policy found <a href="{link}" target="_blank">here</a>.').format(link="https://github.com/Cog-Creators/Red-Dashboard/blob/master/documents/Privacy%20Policy.md") }}
      </div>
      {% else %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>
            {{ _("Looks like something went wrong on Discord's end. Unfortunately, the dashboard's connection to the bot has terminated. Check back later.") }}
          </h5>
        </div>
      </div>
      {% endif %}
      {% elif status == '4' %}
      <div class="card-header">
        <h1 class="title">{{ _('Login Failed') }}</h1>
      </div>
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>{{ _('Looks like the bot owner just terminated the connection to the bot. Check back later.') }}</h5>
        </div>
      </div>
      {% elif status == '5' %}
      <div class="card-header">
        <h1 class="title">{{ _('Login Failed') }}</h1>
      </div>
      {% if redirect %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>
            {{ _('Looks like something went wrong. Try to login again below. If this keeps happening, please report to bot owner or server owner.') }}
          </h5>
        </div>
      </div>
      <div class="card-footer">
        <a
          href="https://discord.com/api/oauth2/authorize?client_id={{ clientid }}&redirect_uri={{ redirect }}&response_type=code&scope=identify"><button
            class="btn">{{ _('Login with Discord') }}</button></a><br>
        {{ _('By clicking the button above, you acknowledge that you have read and agree to our Privacy Policy found <a href="{link}" target="_blank">here</a>.').format(link="https://github.com/Cog-Creators/Red-Dashboard/blob/master/documents/Privacy%20Policy.md") }}
      </div>
      {% else %}
      <div class="card-body">
        <div class="col-md-1 px-md-1"></div>
        <div class="col-md-11 px-md-1">
          <h5>
            {{ _("Looks like something went wrong. Unfortunately, the dashboard's connection to the bot has terminated. Try again later. If it continues to occur, please report to bot owner or server owner.") }}
          </h5>
        </div>
      </div>
      {% endif %}
      {% endif %}
    </div>
  </div>
</div>


{% endblock content %}

<!-- Specific Page JS goes HERE  -->
{% block javascripts %}

{% endblock javascripts %}