From a373e09641934db7bc2f30536b87885b8eb92889 Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Tue, 21 Jan 2020 16:42:37 +0100 Subject: [PATCH] auth_saml: allow custom template for each idp login block (#39154) --- src/authentic2_auth_saml/authenticators.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/authentic2_auth_saml/authenticators.py b/src/authentic2_auth_saml/authenticators.py index 446090cf..d512b57d 100644 --- a/src/authentic2_auth_saml/authenticators.py +++ b/src/authentic2_auth_saml/authenticators.py @@ -35,7 +35,7 @@ class SAMLAuthenticator(object): def instances(self, request, *args, **kwargs): for idx, idp in enumerate(get_idps()): - yield(idx, idp) + yield (idp.get('SLUG') or idx, idp) def login(self, request, *args, **kwargs): context = kwargs.pop('context', {}) @@ -46,7 +46,8 @@ class SAMLAuthenticator(object): instance = kwargs.get('instance') return redirect_to_login(request, login_url='mellon_login', params={'entityID': instance['ENTITY_ID']}) - return render(request, 'authentic2_auth_saml/login.html', context) + return render(request, ['authentic2_auth_saml/login-%s.html' % instance_id, + 'authentic2_auth_saml/login.html'], context) def profile(self, request, *args, **kwargs): context = kwargs.pop('context', {}) -- 2.24.0