app/projrev/views/login.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Tue, 04 Aug 2009 02:21:15 -0400
changeset 0 c94bd9ae70d2
child 1 324233b04d76
permissions -rw-r--r--
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
  """