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.

auth.define_tables(username=True)
auth.settings.create_user_groups=False

3. Add the following at the bottom of page.

Replace server and base_dn to your setting.

# all we need is login
auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']

# 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',
   server='OchibaServer',
   base_dn='dc=ochiba,dc=com')]

4. Result

alt text

alt text

alt text

Related slices

Comments (3)


Hosting graciously provided by:
Python Anywhere