Commit 23d4e170328933fb4f4e2188cc510b5d1f8af8ca

Authored by Sergio Oliveira
1 parent c9fb4c59

Added login view (missing template)

colab/accounts/urls.py
1 1
2 -from django.conf.urls import patterns, include, url 2 +from django.conf.urls import patterns, url
3 3
4 -from .views import (UserProfileDetailView, UserProfileUpdateView, 4 +from .views import (UserProfileDetailView, UserProfileUpdateView, LoginView,
5 ManageUserSubscriptionsView, ChangeXMPPPasswordView) 5 ManageUserSubscriptionsView, ChangeXMPPPasswordView)
6 6
7 -from . import views  
8 7
9 urlpatterns = patterns('', 8 urlpatterns = patterns('',
10 url(r'^register/$', 'colab.accounts.views.signup', name='signup'), 9 url(r'^register/$', 'colab.accounts.views.signup', name='signup'),
@@ -12,6 +11,8 @@ urlpatterns = patterns('', @@ -12,6 +11,8 @@ urlpatterns = patterns('',
12 url(r'^change-password/$', 11 url(r'^change-password/$',
13 ChangeXMPPPasswordView.as_view(), name='change_password'), 12 ChangeXMPPPasswordView.as_view(), name='change_password'),
14 13
  14 + url(r'^login/?$', LoginView.as_view(), name='login'),
  15 +
15 url(r'^(?P<username>[\w@+.-]+)/?$', 16 url(r'^(?P<username>[\w@+.-]+)/?$',
16 UserProfileDetailView.as_view(), name='user_profile'), 17 UserProfileDetailView.as_view(), name='user_profile'),
17 18
colab/accounts/views.py
@@ -13,7 +13,7 @@ from django.utils.translation import ugettext as _ @@ -13,7 +13,7 @@ from django.utils.translation import ugettext as _
13 from django.shortcuts import render, redirect, get_object_or_404 13 from django.shortcuts import render, redirect, get_object_or_404
14 from django.core.urlresolvers import reverse 14 from django.core.urlresolvers import reverse
15 from django.core.exceptions import PermissionDenied 15 from django.core.exceptions import PermissionDenied
16 -from django.views.generic import DetailView, UpdateView 16 +from django.views.generic import DetailView, UpdateView, TemplateView
17 from django.utils.decorators import method_decorator 17 from django.utils.decorators import method_decorator
18 18
19 from django.http import HttpResponse 19 from django.http import HttpResponse
@@ -30,6 +30,10 @@ from .errors import XMPPChangePwdException @@ -30,6 +30,10 @@ from .errors import XMPPChangePwdException
30 from .utils import mailman 30 from .utils import mailman
31 31
32 32
  33 +class LoginView(TemplateView):
  34 + template_name = "accounts/login.html"
  35 +
  36 +
33 class UserProfileBaseMixin(object): 37 class UserProfileBaseMixin(object):
34 model = get_user_model() 38 model = get_user_model()
35 slug_field = 'username' 39 slug_field = 'username'
colab/settings.py
@@ -257,7 +257,7 @@ SITE_URL = &#39;http://localhost:8000&#39; @@ -257,7 +257,7 @@ SITE_URL = &#39;http://localhost:8000&#39;
257 BROWSERID_AUDIENCES = [SITE_URL, SITE_URL.replace('https', 'http')] 257 BROWSERID_AUDIENCES = [SITE_URL, SITE_URL.replace('https', 'http')]
258 258
259 259
260 -LOGIN_URL = '/' 260 +LOGIN_URL = '/user/login'
261 LOGIN_REDIRECT_URL = '/' 261 LOGIN_REDIRECT_URL = '/'
262 LOGIN_REDIRECT_URL_FAILURE = '/' 262 LOGIN_REDIRECT_URL_FAILURE = '/'
263 LOGOUT_REDIRECT_URL = '/' 263 LOGOUT_REDIRECT_URL = '/'