Projet

Général

Profil

0002-auth_oath-record-auth-event-and-move-code-to-utils.patch

Valentin Deniaud, 16 avril 2019 13:47

Télécharger (1,89 ko)

Voir les différences:

Subject: [PATCH 2/5] auth_oath: record auth event and move code to utils

 .../auth2_multifactor/auth_oath/authenticators.py           | 3 +--
 src/authentic2/utils.py                                     | 6 ++++++
 2 files changed, 7 insertions(+), 2 deletions(-)
src/authentic2/auth2_multifactor/auth_oath/authenticators.py
38 38
                if success:
39 39
                    secret.drift = drift
40 40
                    secret.save()
41
                    request.session['auth_level'] = self.auth_level
42
                    return utils.continue_to_next_url(request)
41
                    return utils.auth_level_increase(request, self.auth_level, self.id)
43 42
                form.add_error('code', _('Invalid code.'))
44 43
        context['form'] = form
45 44
        return render(request, 'auth_oath/totp_form.html', context)
src/authentic2/utils.py
404 404
    return None
405 405

  
406 406

  
407
def auth_level_increase(request, auth_level, how):
408
    request.session['auth_level'] = auth_level
409
    record_authentication_event(request, how, auth_level=auth_level)
410
    return continue_to_next_url(request)
411

  
412

  
407 413
def login(request, user, how, service_slug=None, nonce=None, **kwargs):
408 414
    '''Login a user model, record the authentication event and redirect to next
409 415
       URL or settings.LOGIN_REDIRECT_URL.'''
410
-