Projet

Général

Profil

0003-auth_fc-make-autorun-go-directly-to-FranceConnect-UR.patch

Benjamin Dauvergne, 26 janvier 2022 16:12

Télécharger (1,9 ko)

Voir les différences:

Subject: [PATCH 3/6] auth_fc: make autorun go directly to FranceConnect URL
 (#61125)

 src/authentic2_auth_fc/authenticators.py | 5 +++--
 tests/auth_fc/test_auth_fc.py            | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
src/authentic2_auth_fc/authenticators.py
21 21
from authentic2 import app_settings as a2_app_settings
22 22
from authentic2.authenticators import BaseAuthenticator
23 23
from authentic2.utils import misc as utils_misc
24
from authentic2.utils.misc import redirect_to_login
25 24

  
26 25
from . import app_settings
27 26

  
......
41 40
        return 'fc'
42 41

  
43 42
    def autorun(self, request, block_id):
44
        return redirect_to_login(request, login_url='fc-login-or-link')
43
        from . import views
44

  
45
        return views.LoginOrLinkView.as_view(display_message_on_redirect=True)(request)
45 46

  
46 47
    def login(self, request, *args, **kwargs):
47 48
        if 'nofc' in request.GET:
tests/auth_fc/test_auth_fc.py
78 78
    # hide password block
79 79
    settings.AUTH_FRONTENDS_KWARGS = {'password': {'show_condition': 'remote_addr==\'0.0.0.0\''}}
80 80
    response = app.get('/login/')
81
    assert response.location == reverse('fc-login-or-link')
81
    assert response.location.startswith('https://fcp')
82 82

  
83 83

  
84 84
def test_create(settings, app, franceconnect, hooks):
85
-