From b14b3d28035c9b57a14bed80730d268536a46ad6 Mon Sep 17 00:00:00 2001 From: Tomislav R Date: Mon, 7 Mar 2016 19:25:01 +0100 Subject: [PATCH] fixed login --- membership/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/membership/views.py b/membership/views.py index 059592b0..cc60d4d1 100644 --- a/membership/views.py +++ b/membership/views.py @@ -3,6 +3,7 @@ from django.views.generic import View from .models import CustomUser from .forms import LoginForm, RegisterForm +from django.contrib.auth import authenticate,login def validate_email(request, validate_slug): @@ -34,8 +35,9 @@ class LoginRegistrationView(View): return render(request, 'templates/error.html') elif email and password and not name: - user = CustomUser.authenticate(email, password) + user = authenticate(email=email, password=password) if user: + login(request,user) return redirect('membership') else: return render(request, 'templates/login', {'msg': 'Wrong username or password'})