Projet

Général

Profil

0001-misc-allow-authenticator-autorun-if-only-one-availab.patch

Serghei Mihai, 22 novembre 2018 15:53

Télécharger (2,2 ko)

Voir les différences:

Subject: [PATCH] misc: allow authenticator autorun if only one available
 (#28216)

 src/authentic2/auth2_auth/auth2_ssl/authenticators.py | 3 +++
 src/authentic2/views.py                               | 4 ++++
 src/authentic2_auth_saml/authenticators.py            | 3 +++
 3 files changed, 10 insertions(+)
src/authentic2/auth2_auth/auth2_ssl/authenticators.py
21 21
    def form(self):
22 22
        return django.forms.Form
23 23

  
24
    def autorun(self, request):
25
        return redirect_to_login(request, login_url='user_signin_ssl',)
26

  
24 27
    def post(self, request, form, nonce, next_url):
25 28
        return redirect_to_login(request, login_url='user_signin_ssl',)
26 29

  
src/authentic2/views.py
283 283

  
284 284
    frontends = utils.get_backends('AUTH_FRONTENDS', request)
285 285

  
286
    # if only one frontend available and it allow autologin run in
287
    if len(frontends) == 1 and hasattr(frontends[0], 'autorun'):
288
        return frontends[0].autorun(request)
289

  
286 290
    blocks = []
287 291

  
288 292
    registration_url = utils.get_registration_url(
src/authentic2_auth_saml/authenticators.py
20 20
    def name(self):
21 21
        return gettext_noop('SAML')
22 22

  
23
    def autorun(self, request):
24
        return redirect_to_login(request, login_url='mellon_login')
25

  
23 26
    def login(self, request, *args, **kwargs):
24 27
        context = kwargs.pop('context', {})
25 28
        submit_name = 'login-%s' % self.id
26
-