{% extends "base.html" %}

{% block title %}
{% trans %}Domain details{% endtrans %}
{% endblock %}

{% block subtitle %}
{{ domain.name }}
{% endblock %}

{% block main_action %}
{% if current_user.global_admin %}
<a class="btn btn-primary" href="{{ url_for(".domain_genkeys", domain_name=domain.name) }}">
  {% if domain.dkim_publickey %}
  {% trans %}Regenerate keys{% endtrans %}
  {% else %}
  {% trans %}Generate keys{% endtrans %}
  {% endif %}
</a>
{% endif %}
{% endblock %}

{% block content %}
{% call macros.table() %}
{% set hostname = config["HOSTNAMES"].split(",")[0] %}
<tr>
  <th>{% trans %}Domain name{% endtrans %}</th>
  <td>{{ domain.name }}</td>
</tr>
<tr>
  <th>{% trans %}DNS MX entry{% endtrans %} <i class="fa {{ 'fa-check-circle' if domain.check_mx() else 'fa-exclamation-circle' }}"></i></th>
  <td><pre>{{ domain.name }}. 600 IN MX 10 {{ hostname }}.</pre></td>
</tr>
<tr>
  <th>{% trans %}DNS SPF entries{% endtrans %}</th>
  <td><pre>
{{ domain.name }}. 600 IN TXT "v=spf1 mx a:{{ hostname }} -all"
{{ domain.name }}. 600 IN SPF "v=spf1 mx a:{{ hostname }} -all"</pre></td>
</tr>
{% if domain.dkim_publickey %}
<tr>
  <th>{% trans %}DKIM public key{% endtrans %}</th>
  <td><pre style="white-space: pre-wrap; word-wrap: break-word;">{{ domain.dkim_publickey }}</pre></td>
</tr>
<tr>
  <th>{% trans %}DNS DKIM entry{% endtrans %}</th>
  <td><pre style="white-space: pre-wrap; word-wrap: break-word;">{{ config["DKIM_SELECTOR"] }}._domainkey.{{ domain.name }}. IN 600 TXT "v=DKIM1; k=rsa; p={{ domain.dkim_publickey }}"</pre></td>
</tr>
<tr>
  <th>{% trans %}DNS DMARC entry{% endtrans %}</th>
  <td><pre>_dmarc.{{ domain.name }}. 600 IN TXT "v=DMARC1; p=reject;{% if config["DMARC_RUA"] %} rua=mailto:{{ config["DMARC_RUA"] }}@{{ config["DOMAIN"] }};{% endif %}{% if config["DMARC_RUF"] %} ruf=mailto:{{ config["DMARC_RUF"] }}@{{ config["DOMAIN"] }};{% endif %} adkim=s; aspf=s"</pre></td>
</tr>
{% endif %}
{% endcall %}
{% endblock %}
