Skip to content

Commit 0859d6a

Browse files
committed
Allow to override sign in and sign out views
This is needed for corporate
1 parent 0dd5b61 commit 0859d6a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

readthedocs/profiles/urls/private.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
urlpatterns = []
1212

1313
account_urls = [
14+
url(
15+
r'^login',
16+
views.LoginView.as_view(),
17+
name='account_login',
18+
),
19+
url(
20+
r'^logout/',
21+
views.LogoutView.as_view(),
22+
name='account_logout',
23+
),
1424
url(
1525
r'^edit/',
1626
views.ProfileEdit.as_view(),

readthedocs/profiles/views.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Views for creating, editing and viewing site-specific user profiles."""
22

3+
from allauth.account.views import LoginView as AllAuthLoginView
4+
from allauth.account.views import LogoutView as AllAuthLogoutView
35
from django.contrib import messages
46
from django.contrib.auth import logout
57
from django.contrib.auth.models import User
@@ -27,6 +29,26 @@
2729
from readthedocs.core.utils.extend import SettingsOverrideObject
2830

2931

32+
class LoginViewBase(AllAuthLoginView):
33+
34+
pass
35+
36+
37+
class LoginView(SettingsOverrideObject):
38+
39+
_default_class = LoginViewBase
40+
41+
42+
class LogoutViewBase(AllAuthLogoutView):
43+
44+
pass
45+
46+
47+
class LogoutView(SettingsOverrideObject):
48+
49+
_default_class = LogoutViewBase
50+
51+
3052
class ProfileEdit(PrivateViewMixin, UpdateView):
3153

3254
"""Edit the current user's profile."""

0 commit comments

Comments
 (0)