adapt image/text to configured factors (#61856)

This commit is contained in:
Frédéric Péters 2022-02-16 14:40:21 +01:00
parent b6d39c939b
commit f607b5e478
4 changed files with 33 additions and 10 deletions

View File

@ -44,6 +44,7 @@ class FedictAuthenticator(BaseAuthenticator):
if request.method == 'POST' and submit_name in request.POST:
return redirect_to_login(request, login_url='fedict-login')
context['submit_name'] = submit_name
context.update(self.get_supported_methods())
return render(request, 'authentic2_auth_fedict/login.html', context)
def profile(self, request, *args, **kwargs):
@ -52,4 +53,16 @@ class FedictAuthenticator(BaseAuthenticator):
for user_saml_identifier in user_saml_identifiers:
user_saml_identifier.idp = get_idp(user_saml_identifier.issuer)
context['user_saml_identifiers'] = user_saml_identifiers
context.update(self.get_supported_methods())
return render_to_string('authentic2_auth_fedict/profile.html', context, request=request)
def get_supported_methods(self):
try:
idp = [x for x in list(get_idps()) if 'belgium.be' in x.get('ENTITY_ID')][0]
authn_classref = idp['AUTHN_CLASSREF']
except (IndexError, KeyError):
authn_classref = ''
return {
'has_tokens': 'urn:be:fedict:iam:fas:citizen:token' in authn_classref,
'has_itsme': 'urn:be:fedict:iam:fas:citizen:bmid' in authn_classref,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,11 +1,16 @@
{% load i18n static %}<form method="post" id="csam-login">
<div>
<img src="{% static "authentic2_auth_fedict/img/beid_image_mini.png" %}" alt="">
{% if has_itsme %}
<img src="{% static "authentic2_auth_fedict/img/beid-itsme.png" %}" alt="">
{% else %}
<img src="{% static "authentic2_auth_fedict/img/beid_image_mini.png" %}" alt="">
{% endif %}
<p>
{% blocktrans %}
In order to log in, you will either need your eID card and its card reader
or your list of personal tokens.
{% endblocktrans %}
{% spaceless %}
{% trans "In order to log in, you will need your eID card and a card reader" %}{% if has_tokens %}
{% trans "or your list of personal tokens" %}{% endif %}{% if has_itsme %}
{% trans "or an itsme account" %}{% endif %}.
{% endspaceless %}
</p>
<p>
<button name="{{ submit_name }}">{% trans "Login" %}</button>

View File

@ -1,6 +1,10 @@
{% load i18n static %}
<div>
{% if has_itsme %}
<img src="{% static "authentic2_auth_fedict/img/beid-itsme.png" %}" alt="">
{% else %}
<img src="{% static "authentic2_auth_fedict/img/beid_image_mini.png" %}" alt="">
{% endif %}
{% if user_saml_identifiers %}
<p>{% blocktrans %}This account is linked to your eID card.{% endblocktrans %}</p>
<div class="unlink-block">
@ -15,11 +19,12 @@
</div>
{% else %}
<p>
{% blocktrans %}
You may want to link your existing account to your eID. In order to
do so, you will either need your eID card and its card reader
or your list of personal tokens.
{% endblocktrans %}
{% spaceless %}
{% trans "You may want to link your existing account to your eID." %}
{% trans "In order to do so, you will need your eID card and a card reader" %}{% if has_tokens %}
{% trans "or your list of personal tokens" %}{% endif %}{% if has_itsme %}
{% trans "or an itsme account" %}{% endif %}.
{% endspaceless %}
</p>
<p><a class="button" href="{% url "fedict-login" %}?next=/accounts/">{% trans "Link my account to my eID card" %}</a></p>
{% endif %}