{% extends "base.html" %} {% from "components/ui.html" import breadcrumb, csrf_field with context %} {% from "components/connection.html" import connection_fields %} {% block title %}Connect an account ยท {{ APP_NAME }}{% endblock %} {% block heading %}Connect an account{% endblock %} {% block subheading %}{{ breadcrumb([("Accounts", "/ui/accounts"), ("Connect an account", None)]) }}{% endblock %} {% block content %} {# Connect with a password: ``settings`` fill the server fields, a ``provider`` names the candidate's, ``suffix`` keeps ids apart, ``error`` shows under the password why the last try was refused. #} {% macro connect_form(email, settings, suffix="", provider=None, password_label="Password", hint=None, folded=True, primary=True, display_name="", error=None) %} {% set ids = "-" ~ suffix if suffix else "" %}
{{ csrf_field() }} {% if provider %}{% endif %}
{% if error %}{{ error }}{% endif %} {% if hint %}{{ hint }}{% endif %}
{% if folded %}
Servers {{ connection_fields(settings, security, suffix=suffix) }}
{% else %}
{{ connection_fields(settings, security, suffix=suffix) }}
{% endif %}
Connect
{% endmacro %} {% macro sign_in_form(provider, hint="") %}
{{ csrf_field() }}
{% endmacro %}

1. The address

{{ csrf_field() }}

Asks public sources how the address's provider is reached. No password leaves this service.

{% if retry %}

2. Your servers

The provider refused. Nothing was stored.
{{ connect_form(email, retry.settings, provider=retry.provider, folded=False, display_name=retry.display_name, error=retry.error, hint="Tried against the provider first, then stored encrypted. Never shown again.") }}
{% endif %} {% if discovery %} {% for hint in discovery.hints %}
{{ hint.text }}{% if hint.url %} More{% endif %}
{% endfor %}

2. How to connect {{ discovery.email }}

{% for candidate in sign_ins %}

{{ candidate.name or discovery.domain }}

found by {{ candidate.source.value }} {% if loop.first %}recommended{% endif %}
{{ sign_in_form(candidate.oauth_provider, discovery.email) }} No password is needed. {{ candidate.oauth_provider | capitalize }} asks you, and this service keeps only a token it can renew.
{% endfor %} {% for candidate in usable %}

{{ candidate.name or discovery.domain }}

found by {{ candidate.source.value }} {% if loop.first and not sign_ins %}recommended{% endif %} {% if candidate.confirmed %}trusted source{% else %}check these servers{% endif %}
{% if not candidate.confirmed %}
This answer does not come from the domain itself or from a known provider. Connect only if the servers below are really your provider's.
{% endif %} {% for hint in candidate.hints %}

{{ hint.text }}{% if hint.url %} More{% endif %}

{% endfor %} {{ connect_form(discovery.email, candidate.settings, suffix=loop.index, provider=candidate.provider.value, password_label="App password" if candidate.credential.value == "app_password" else "Password", hint="Tried against the provider first, then stored encrypted. Never shown again.") }}
{% endfor %} {% if oauth_providers and not sign_ins %}

Sign in with your provider

if the address is at one of these
{% for provider in oauth_providers %}{{ sign_in_form(provider, discovery.email) }}{% endfor %}
{% endif %}

Set up by hand

{% if not usable and not sign_ins %}

No way to connect {{ discovery.email }} over IMAP was found. Enter your provider's servers.

{% endif %} {{ connect_form(discovery.email, {}, suffix="hand", folded=False, primary=not usable and not sign_ins) }}

What the sources answered

{% for report in discovery.sources %} {% endfor %}
{{ report.source.value }}{{ report.outcome.value }}{{ report.message | or_missing }}
{% endif %}
Cancel
{% endblock %}