First commit.
"""This module contains the views for the login for the portal.
"""
__authors__ = [
'"Madhusudan.C.S" <madhusudancs@gmail.com>',
]
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response, get_object_or_404
def login_validate(request):
"""Validate the user and log him in.
"""
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
# Redirect to a success page.
else:
pass
# Return a 'disabled account' error message
else:
# Return an 'invalid login' error message.
pass
def logout_view(request):
"""Logout the user
"""