{% extends "sentry/bases/auth.html" %}

{% load crispy_forms_tags %}
{% load i18n %}
{% load sentry_helpers %}

{% block title %}{% trans "Confirm Identity" %} | {{ block.super }}{% endblock %}

{% block auth_main %}
  <form class="form-stacked" action="" method="post">
    {% csrf_token %}

    <div class="sso-link">
      <span class="avatar">
        {% letter_avatar_svg existing_user.get_display_name existing_user.get_label %}
        {% if existing_user.get_avatar_type == 'upload' %}
          <img src="{% profile_photo_url existing_user.id size 36 %}">
        {% elif existing_user.get_avatar_type == 'gravatar' %}
          <img src="{% gravatar_url existing_user.email size 36 default 'blank' %}">
        {% endif %}
      </span>
      <span class="icon-arrow-right"></span>
      <span class="icon-arrow-left"></span>
      <span class="avatar">
        {% letter_avatar_svg identity_display_name identity_identifier %}
        <img src="{% gravatar_url identity.email size 36 default 'blank' %}">
      </span>
    </div>

    <div class="align-center">

      {% if existing_user.email == identity.email %}
        <p>We're going to associate your new identity with your existing account which means all of your existing settings will stay intact.</p>

        <p>
          <button class="btn btn-primary" name="op" value="confirm" type="submit">Continue</button>
        </p>
      {% else %}
        <p>Would you like to associate this identity with your existing account? If not, we'll go ahead and create a new account for you.</p>

        <p>
          <button class="btn btn-default" name="op" value="newuser" type="submit">No thanks</button>
          <button class="btn btn-primary" name="op" value="confirm" type="submit">Merge accounts</button>
        </p>
      {% endif %}
    </div>
  </form>
{% endblock %}
