{% extends "admin/base_site.html" %}
{% load i18n static %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}">
{{ form.media }}
{% endblock %}

{% block bodyclass %}{{ block.super }} login{% endblock %}

{% block branding %}<h1>ArchiveBox Admin</h1>{% endblock %}

{% block usertools %}
<br/>
  <a href="{% url 'Home' %}">Back to Main Index</a>
{% endblock %}

{% block nav-global %}{% endblock %}

{% block content_title %}
  <center>
    Log in to add, edit, and remove links from your archive.
  </center><br/><br/>
  <img src="{% static 'archive.png' %}" style="width: 80px; display: block; margin: auto"/><br/>
{% endblock %}

{% block breadcrumbs %}{% endblock %}

{% block content %}
{% if form.errors and not form.non_field_errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
</p>
{% endif %}

{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<p class="errornote">
    {{ error }}
</p>
{% endfor %}
{% endif %}

<div id="content-main">

{% if user.is_authenticated %}
<p class="errornote">
{% blocktrans trimmed %}
    You are authenticated as {{ username }}, but are not authorized to
    access this page. Would you like to login to a different account?
{% endblocktrans %}
</p>
{% endif %}

<br/>
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
  <div class="form-row">
    {{ form.username.errors }}
    {{ form.username.label_tag }} {{ form.username }}
  </div>
  <div class="form-row">
    {{ form.password.errors }}
    {{ form.password.label_tag }} {{ form.password }}
    <input type="hidden" name="next" value="{{ next }}">
  </div>
  {% url 'admin_password_reset' as password_reset_url %}
  {% if password_reset_url %}
  <div class="password-reset-link">
    <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
  </div>
  {% endif %}
  <div class="submit-row">
    <label>&nbsp;</label><input type="submit" value="{% trans 'Log in' %}">
  </div>
</form>

<center>
  <br/><br/>
  <hr/>
  <br/>
  If you forgot your password, <a href="/accounts/password_reset/">reset it here</a> or run:<br/>
<pre>
archivebox manage changepassword USERNAME
</pre>

  <br/><br/>
  <hr/>
  <br/>
  To create a new admin user, run the following:
<pre>
archivebox manage createsuperuser
</pre>
  <br/>
  <hr/>

  <small><i>(cd into your archive folder before running commands)</i></small>
</center>


</div>
{% endblock %}
