From d234fd942dbe219a948a635b6536bd0bc49ab641 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Thu, 26 Oct 2017 11:21:56 +1100 Subject: [PATCH] Refactor the login views into their own modules, because I'm about to implement IndieAuth and it's gonna be kinda big --- lemonauth/views/__init__.py | 2 ++ lemonauth/{views.py => views/login.py} | 5 ++--- lemonauth/views/logout.py | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 lemonauth/views/__init__.py rename lemonauth/{views.py => views/login.py} (71%) create mode 100644 lemonauth/views/logout.py diff --git a/lemonauth/views/__init__.py b/lemonauth/views/__init__.py new file mode 100644 index 0000000..927e309 --- /dev/null +++ b/lemonauth/views/__init__.py @@ -0,0 +1,2 @@ +from .login import login +from .logout import logout diff --git a/lemonauth/views.py b/lemonauth/views/login.py similarity index 71% rename from lemonauth/views.py rename to lemonauth/views/login.py index b16802b..5e4b192 100644 --- a/lemonauth/views.py +++ b/lemonauth/views/login.py @@ -1,13 +1,12 @@ -from django.contrib.auth import views as auth_views +import django.contrib.auth.views from otp_agents.forms import OTPAuthenticationForm from lemoncurry import breadcrumbs breadcrumbs.add(route='lemonauth:login', label='log in', parent='home:index') -login = auth_views.LoginView.as_view( +login = django.contrib.auth.views.LoginView.as_view( authentication_form=OTPAuthenticationForm, extra_context={'title': 'log in'}, template_name='lemonauth/login.html', redirect_authenticated_user=True, ) -logout = auth_views.LogoutView.as_view() diff --git a/lemonauth/views/logout.py b/lemonauth/views/logout.py new file mode 100644 index 0000000..00514f4 --- /dev/null +++ b/lemonauth/views/logout.py @@ -0,0 +1,3 @@ +import django.contrib.auth.views + +logout = django.contrib.auth.views.LogoutView.as_view()