def audited_login(request, *args, **kwargs): kwargs['template_name'] = login_template() # call the login function response = LoginView.as_view(*args, **kwargs)(request) if request.method == 'POST': # see if the login was successful login_unsuccessful = (response and not response.has_header('location') and response.status_code != 302) if log_request(request, login_unsuccessful): return response else: # failed, and lockout return lockout_response(request) return response
def audited_login(request, *args, **kwargs): func = auth_views.login kwargs['template_name'] = login_template() # call the login function response = func(request, *args, **kwargs) if request.method == 'POST': # see if the login was successful login_unsuccessful = ( response and not response.has_header('location') and response.status_code != 302 ) if log_request(request, login_unsuccessful): return response else: # failed, and lockout return lockout_response(request) return response