If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

Install python-ldap

1. Download and install python-ldap (e.g. python-ldap-2.4.3.win32-py2.7)

Edit models/db.py

2. edit auth.define_tables() to allow login with username and not email.


3. Add the following at the bottom of page.

Replace server and base_dn to your setting.

# all we need is login

# you don't have to remember me
auth.settings.remember_me_form = False

# ldap authentication and not save password on web2py
from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',

4. Result

alt text

alt text

alt text

Related slices

Comments (5)

Hosting graciously provided by:
Python Anywhere