{% extends "base.html" %} {% from "components/ui.html" import 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 %}
Look up how to reach an address, then sign in with its password
{% endblock %} {% block content %} {# Connect with a password: ``settings`` fill the server fields, a ``provider`` names the candidate's, ``suffix`` keeps ids apart. #} {% macro connect_form(email, settings, suffix="", provider=None, password_label="Password", hint=None, folded=True, primary=True) %} {% set ids = "-" ~ suffix if suffix else "" %}
{{ csrf_field() }} {% if provider %}{% endif %}
{% if hint %}{{ hint }}{% endif %}
{% if folded %}
Servers {{ connection_fields(settings, security) }}
{% else %}
{{ connection_fields(settings, security) }}
{% endif %}
Connect
{% endmacro %} {% macro sign_in_form(provider, hint="") %}
{{ csrf_field() }}
{% endmacro %} {% if oauth_providers and not discovery %}

Sign in with your provider

{% for provider in oauth_providers %}{{ sign_in_form(provider) }}{% endfor %} No password is needed. The provider asks you, and this service keeps only a token it can renew.
{% endif %}

1. The address

{{ csrf_field() }}

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

{% if discovery %} {% for hint in discovery.hints %}
{{ hint.text }}{% if hint.url %} More{% endif %}
{% endfor %} {% for candidate in sign_ins %}

2. {{ candidate.name or discovery.domain }}

found by {{ candidate.source.value }}
{{ 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 %}

2. {{ candidate.name or discovery.domain }}

found by {{ candidate.source.value }} {% 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 %}

{{ "Or set it up by hand" if usable or sign_ins else "2. Set it 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, {}, folded=False, primary=False) }}
What the sources answered
{% for report in discovery.sources %} {% endfor %}
{{ report.source.value }}{{ report.outcome.value }}{{ report.message | or_missing }}
{% endif %} {% endblock %}