def login(request):
template = "main/login.html"
params = dict()
if request.method == "POST":
email = request.POST.get("email", "").lower()
password = request.POST.get("password", "")
print request.user.is_authenticated
user = authenticate(username=email, password=password)
print user
if user:
print request.user.is_authenticated
template = "main/index.html"
return render(request, template, params)
return render(request, template, params)