diff --git a/src/postorius/templates/postorius/login.html b/src/postorius/templates/postorius/login.html index 644fa2e..dcd545d 100644 --- a/src/postorius/templates/postorius/login.html +++ b/src/postorius/templates/postorius/login.html @@ -8,15 +8,17 @@

Login with username and password or with Mozilla Persona

+
{% csrf_token %} {{ form.as_p }}
- +
-
- -
+ +
+ +
{% csrf_token %} Login using BrowserID diff --git a/src/postorius/urls.py b/src/postorius/urls.py index df2be43..2ccd47f 100644 --- a/src/postorius/urls.py +++ b/src/postorius/urls.py @@ -19,6 +19,7 @@ from django.conf.urls import * from django.conf import settings from django.conf.urls.static import static +from django.contrib.auth.views import login as login_view from postorius.views import * from postorius.views.generic import * @@ -82,7 +83,7 @@ 'postorius.views', (r'^$', 'list_index'), # /account/ - url(r'^accounts/login/$', 'user_login', name='user_login'), + url(r'^accounts/login/$', login_view, {"template_name": "postorius/login.html"}, name='user_login'), url(r'^accounts/logout/$', 'user_logout', name='user_logout'), url(r'^accounts/profile/$', 'user_profile', name='user_profile'), url(r'^tasks/$', 'user_tasks', name='user_tasks'), diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index fac5df2..f313027 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -25,7 +25,6 @@ from django.contrib.auth import logout, authenticate, login from django.contrib.auth.decorators import (login_required, user_passes_test) -from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.models import User from django.shortcuts import render_to_response, redirect from django.template import RequestContext @@ -308,21 +307,6 @@ return redirect('user_login') -def user_login(request, template='postorius/login.html'): - if request.method == 'POST': - form = AuthenticationForm(request.POST) - user = authenticate(username=request.POST.get('username'), - password=request.POST.get('password')) - if user is not None: - if user.is_active: - login(request, user) - return redirect(request.GET.get('next', 'list_index')) - else: - form = AuthenticationForm() - return render_to_response(template, {'form': form}, - context_instance=RequestContext(request)) - - @login_required() def user_profile(request, user_email=None): if not request.user.is_authenticated():