Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

django-iitg-auth`` is a reusable Django application for which provides a custom authencation backend for authenticating with IIT Guwahati webmail servers, a login form and a utility view

Project description


django-iitg-auth is a reusable Django application which provides a custom authencation backend for authenticating with IIT Guwahati webmail servers, a login form and a utility view.


django-iitg-auth can be installed using following pip command.

pip install git+

Usage: Authentication Backend

Add 'iitgauth' to INSTALLED_APPS settings of the project.


Add 'iitgauth.auth.WebMailAuthenticationBackend' to AUTHENTICATION_BACKENDS in


This is all the configuration required to use the webmail authentication backend.

Note that authenticate method of the backend requires following credentials:
  • username
  • password
  • login server
  • port (default is set to 995)

Following snippet shows how webmail authentication can be done in a custom view.

from django.contrib.auth import authenticate
from django.views.generic import View

class LoginView(View):

    def get(self, request):
        # get request handling logic

    def post(self, request):
        form = LoginForm(request.POST)
        if form.is_valid():
            username = form.cleaned_data('username')
            password = form.cleaned_data('password')
            login_server = form.cleaned_data('login_server')

            # open a socket to login server and query validity of credentials
            user = auth.authenticate(username=username, password=password,
                        login_server=login_server, port=995)
            # rest of authentication logic
           # invalid form hadling

Usage: WebmailLoginForm and WebmailLoginView

A ready-to-use form (WebmailLoginForm) and a class based view (WebmailLoginView) are also available. Using this form and view is not necessary. You can write your own custom login form and view to use with webmail authentication backend as explained above.

This form works exactly similar to Django’s built-in AuthenticationForm. Only difference is WebmailLoginForm has one extra field, .i.e. Login Server field.

WebmailLoginForm has 3 fields:
  • username
  • password
  • login_server

WebmailLoginView is a FormView which renders WebmailLoginForm on GET and redirects to success_url on successful authentication.


Note: There is a working demo project available under example directory.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-iitg-auth, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_iitg_auth-0.0.1-py2.py3-none-any.whl (8.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-iitg-auth-0.0.1.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page