Project

General

Profile

Support #39567

login: virer le code de gestion des moyens d'authentification "legacy"

Added by Serghei Mihai 6 months ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
05 Feb 2020
Due date:
% Done:

0%

Patch proposed:
No
Planning:
No

Description

Dans views.py::login le bout de code:

    # Create blocks
    for authenticator in authenticators:
        # Legacy API
        if not hasattr(authenticator, 'login'):
            fid = authenticator.id
            name = authenticator.name
            form_class = authenticator.form()
            submit_name = 'submit-%s' % fid
            block = {
                'id': fid,
                'name': name,
                'authenticator': authenticator
            }
            if request.method == 'POST' and submit_name in request.POST:
                form = form_class(data=request.POST)
                if form.is_valid():
                    if request.session.test_cookie_worked():
                        request.session.delete_test_cookie()
                    return authenticator.post(request, form, nonce, redirect_to)
                block['form'] = form
            else:
                block['form'] = form_class()
            blocks.append(block)
        else:  # New frontends API
            auth_blocks = []

doit gérer les plugins avec une signature de login ancienne.

Il y a eu un travail de migration des plugins dans le tronc commun d'authentic. Il en reste qui ne sont pas migrés?
Ça serait bien de virer ce code legacy pour simplifier le code de login.

Also available in: Atom PDF