diff --git a/src/authentic2_auth_fedict/authenticators.py b/src/authentic2_auth_fedict/authenticators.py index a18425d..b6b6115 100644 --- a/src/authentic2_auth_fedict/authenticators.py +++ b/src/authentic2_auth_fedict/authenticators.py @@ -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, + } diff --git a/src/authentic2_auth_fedict/static/authentic2_auth_fedict/img/beid-itsme.png b/src/authentic2_auth_fedict/static/authentic2_auth_fedict/img/beid-itsme.png new file mode 100644 index 0000000..bc88b30 Binary files /dev/null and b/src/authentic2_auth_fedict/static/authentic2_auth_fedict/img/beid-itsme.png differ diff --git a/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/login.html b/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/login.html index e65e918..2614274 100644 --- a/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/login.html +++ b/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/login.html @@ -1,11 +1,16 @@ {% load i18n static %}
- + {% if has_itsme %} + + {% else %} + + {% endif %}

- {% 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 %}

diff --git a/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/profile.html b/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/profile.html index 8a1f9b6..fbdc0e8 100644 --- a/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/profile.html +++ b/src/authentic2_auth_fedict/templates/authentic2_auth_fedict/profile.html @@ -1,6 +1,10 @@ {% load i18n static %}

+ {% if has_itsme %} + + {% else %} + {% endif %} {% if user_saml_identifiers %}

{% blocktrans %}This account is linked to your eID card.{% endblocktrans %}

{% else %}

- {% 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 %}

{% trans "Link my account to my eID card" %}

{% endif %}