{% 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 %}
        {% element p %}
            {% blocktrans %}You can sign in to your account using any of the following third-party accounts:{% endblocktrans %}
        {% endelement %}
        {% 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 %}
        {% element p %}
            {% trans 'You currently have no third-party accounts connected to this account.' %}
        {% endelement %}
    {% 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 %}
