From a82f825a456a4ee7cb30a19f0c77f2a08b2e3afe Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 2 Feb 2015 12:52:13 +0100 Subject: [PATCH] =?UTF-8?q?Impl=C3=A9mente=20la=20vue=20de=20login=20avec?= =?UTF-8?q?=20questions=20secr=C3=A8tes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- authentic2/src/authentic2_auf/urls.py | 8 +++++--- authentic2/src/authentic2_auf/views.py | 12 +++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/authentic2/src/authentic2_auf/urls.py b/authentic2/src/authentic2_auf/urls.py index 9f9e971..d074665 100644 --- a/authentic2/src/authentic2_auf/urls.py +++ b/authentic2/src/authentic2_auf/urls.py @@ -3,12 +3,14 @@ from django.conf.urls import patterns, url from authentic2.decorators import setting_enabled, required from . import app_settings -from .views import index +from .views import lost_password_login, secret_questions urlpatterns = required( setting_enabled('ENABLE', settings=app_settings), patterns('', - url('^authentic2_auf/$', index, - name='authentic2-auf-index'), + url('^accounts/auf/lost-password/$', lost_password_login, + name='authentic2-auf-lost-password'), + url('^accounts/auf/secret-questions/$', secret_questions, + name='authentic2-auf-secret-questions'), ) ) diff --git a/authentic2/src/authentic2_auf/views.py b/authentic2/src/authentic2_auf/views.py index 6ced003..fc5a192 100644 --- a/authentic2/src/authentic2_auf/views.py +++ b/authentic2/src/authentic2_auf/views.py @@ -1,10 +1,16 @@ from django.shortcuts import render +from auth.django.secretquestions.decorators import secret_questions_required +from auth.django.secretquestions.views import secret_questions +from django.contrib.auth import authenticate - +from authentic2.utils import login from . import decorators __ALL_ = [ 'sso' ] @decorators.plugin_enabled -def index(request): - return render(request, 'authentic2_auf/index.html') +@secret_questions_required(60) +def lost_password_login(request) + user = authenticate(user=request.user) + return login(request, user, 'secret-questions') +