{% extends "socialaccount/base_manage.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
    {% trans "Account Connections" %}
{% endblock head_title %}
{% block content %}
    {% element h1 %}
        {% trans "Account Connections" %}
    {% endelement %}
    {% if form.accounts %}
        <p>
            {% blocktrans %}You can sign in to your account using any of the following third-party accounts:{% endblocktrans %}
        </p>
        {% url 'socialaccount_connections' as action_url %}
        {% element form form=form method="post" action=action_url %}
            {% slot body %}
                {% csrf_token %}
                {% for acc in form.fields.account.choices %}
                    {% with account=acc.0.instance.get_provider_account %}
                        {% setvar radio_id %}
                            id_account_{{ account.account.pk }}
                        {% endsetvar %}
                        {% setvar tags %}
                            socialaccount,{{ account.account.provider }}
                        {% endsetvar %}
                        {% element field id=radio_id type="radio" name="account" value=account.account.pk %}
                            {% slot label %}
                                {{ account }}
                                {% element badge tags=tags %}
                                    {{ account.get_brand.name }}
                                {% endelement %}
                            {% endslot %}
                        {% endelement %}
                    {% endwith %}
                {% endfor %}
            {% endslot %}
            {% slot actions %}
                {% element button tags="delete,danger" type="submit" %}
                    {% trans 'Remove' %}
                {% endelement %}
            {% endslot %}
        {% endelement %}
    {% else %}
        <p>{% trans 'You currently have no social network accounts connected to this account.' %}</p>
    {% endif %}
    {% element h2 %}
        {% trans 'Add a Third-Party Account' %}
    {% endelement %}
    {% include "socialaccount/snippets/provider_list.html" with process="connect" %}
    {% include "socialaccount/snippets/login_extra.html" %}
{% endblock content %}
