|
| 1 | +{# |
| 2 | +Copyright 2024 New Vector Ltd. |
| 3 | +Copyright 2021-2024 The Matrix.org Foundation C.I.C. |
| 4 | + |
| 5 | +SPDX-License-Identifier: AGPL-3.0-only |
| 6 | +Please see LICENSE in the repository root for full details. |
| 7 | +-#} |
| 8 | + |
| 9 | +{% extends "base.html" %} |
| 10 | + |
| 11 | +{% from "components/idp_brand.html" import logo %} |
| 12 | + |
| 13 | +{% block content %} |
| 14 | + <form method="POST" class="flex flex-col gap-10"> |
| 15 | + <header class="page-heading"> |
| 16 | + <!-- |
| 17 | + <div class="icon"> |
| 18 | + {{ icon.user_profile_solid() }} |
| 19 | + </div> |
| 20 | + --> |
| 21 | + {% if next and next.kind == "link_upstream" %} |
| 22 | + <div class="header"> |
| 23 | + <h1 class="title">{{ _("mas.login.link.headline") }}</h1> |
| 24 | + {% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %} |
| 25 | + <p class="text">{{ _("mas.login.link.description", provider=name) }}</p> |
| 26 | + </div> |
| 27 | + {% else %} |
| 28 | + <div class="header"> |
| 29 | + <h1 class="title">{{ _("mas.login.headline") }}</h1> |
| 30 | + <!-- <p class="text">{{ _("mas.login.description") }}</p> --> |
| 31 | + </div> |
| 32 | + {% endif %} |
| 33 | + </header> |
| 34 | + |
| 35 | + <!-- #tchap# --> |
| 36 | + {% set params = next["params"] | default({}) | to_params(prefix="?") %} |
| 37 | + {% for provider in providers %} |
| 38 | + {% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %} |
| 39 | + |
| 40 | + <!-- #tchap# add .lasuite class to add lasuite fonts --> |
| 41 | + <div class="cpd-form-root lasuite"> |
| 42 | + <button class="proconnect-button" onclick="window.location.href = '{{ ('/upstream/authorize/' ~ provider.id ~ params) | prefix_url }}';"> |
| 43 | + <span class="proconnect-sr-only">S'identifier avec ProConnect</span> |
| 44 | + </button> |
| 45 | + <p> |
| 46 | + <a |
| 47 | + href="https://www.proconnect.gouv.fr/" |
| 48 | + target="_blank" |
| 49 | + rel="noopener noreferrer" |
| 50 | + title="Qu’est-ce que ProConnect ? - nouvelle fenêtre" |
| 51 | + > |
| 52 | + Qu’est-ce que ProConnect ? |
| 53 | + </a> |
| 54 | + </p> |
| 55 | + </div> |
| 56 | + {% endfor %} |
| 57 | + <!-- #tchap# end --> |
| 58 | + <!-- |
| 59 | + {% if providers %} |
| 60 | + {% set params = next["params"] | default({}) | to_params(prefix="?") %} |
| 61 | + {% for provider in providers %} |
| 62 | + {% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %} |
| 63 | + |
| 64 | + <a class="cpd-button {%- if provider.brand_name %} has-icon {%- endif %}" data-kind="secondary" data-size="lg" href="{{ ('/upstream/authorize/' ~ provider.id ~ params) | prefix_url }}"> |
| 65 | + {{ logo(provider.brand_name) }} |
| 66 | + {{ _("mas.login.continue_with_provider", provider=name) }} |
| 67 | + </a> |
| 68 | + {% endfor %} |
| 69 | + {% endif %} |
| 70 | + --> |
| 71 | + |
| 72 | + |
| 73 | + {{ field.separator() }} |
| 74 | + |
| 75 | + |
| 76 | + <div class="cpd-form-root"> |
| 77 | + {% if form.errors is not empty %} |
| 78 | + {% for error in form.errors %} |
| 79 | + <div class="text-critical font-medium"> |
| 80 | + {{ errors.form_error_message(error=error) }} |
| 81 | + </div> |
| 82 | + {% endfor %} |
| 83 | + {% endif %} |
| 84 | + |
| 85 | + <input type="hidden" name="csrf" value="{{ csrf_token }}" /> |
| 86 | + |
| 87 | + {% if features.login_with_email_allowed %} |
| 88 | + {% call(f) field.field(label=_("mas.login.username_or_email"), name="username", form_state=form) %} |
| 89 | + <input {{ field.attributes(f) }} class="cpd-text-control" type="text" autocomplete="username" autocorrect="off" autocapitalize="off" required /> |
| 90 | + {% endcall %} |
| 91 | + {% else %} |
| 92 | + {% call(f) field.field(label=_("common.username"), name="username", form_state=form) %} |
| 93 | + <input {{ field.attributes(f) }} class="cpd-text-control" type="text" autocomplete="username" autocorrect="off" autocapitalize="off" required /> |
| 94 | + {% endcall %} |
| 95 | + {% endif %} |
| 96 | + |
| 97 | + {% if features.password_login %} |
| 98 | + {% call(f) field.field(label=_("common.password"), name="password", form_state=form) %} |
| 99 | + <input {{ field.attributes(f) }} class="cpd-text-control" type="password" autocomplete="password" required /> |
| 100 | + {% endcall %} |
| 101 | + |
| 102 | + {% if features.account_recovery %} |
| 103 | + {{ button.link_text(text=_("mas.login.forgot_password"), href="/recover", class="self-center") }} |
| 104 | + {% endif %} |
| 105 | + {% endif %} |
| 106 | + </div> |
| 107 | + |
| 108 | + <div class="cpd-form-root"> |
| 109 | + {% if features.password_login %} |
| 110 | + {{ button.button(text=_("action.continue")) }} |
| 111 | + {% endif %} |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + </div> |
| 117 | + |
| 118 | + {% if (not next or next.kind != "link_upstream") and features.password_registration %} |
| 119 | + <div class="flex gap-1 justify-center items-center cpd-text-body-md-regular"> |
| 120 | + <p class="cpd-text-secondary"> |
| 121 | + {{ _("mas.login.call_to_register") }} |
| 122 | + </p> |
| 123 | + |
| 124 | + |
| 125 | + {% set params = next["params"] | default({}) | to_params(prefix="?") %} |
| 126 | + {{ button.link_text(text=_("action.create_account"), href="/register" ~ params) }} |
| 127 | + </div> |
| 128 | + {% endif %} |
| 129 | + |
| 130 | + {% if not providers and not features.password_login %} |
| 131 | + <div class="text-center"> |
| 132 | + {{ _("mas.login.no_login_methods") }} |
| 133 | + </div> |
| 134 | + {% endif %} |
| 135 | + </form> |
| 136 | +{% endblock content %} |
0 commit comments