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)
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
This was a really great tutorial.
ReplyDeleteHow easy when knowing what to do.
Regards Falk
Thanks !
ReplyDeleteI just want to add that if you are using 1.99.4 this won't work. It's not due to anything wrong with the instructions, it's a bug. There's a fix for it here.
ReplyDeletehttp://code.google.com/p/web2py/issues/detail?id=565&can=1&q=ldap
@Derek - that fix did not work for me.
DeleteDerek,
ReplyDeleteThank you for the comment. Yes I maded the fix :)
1.99.6 will be released next few weeks which includes this patch so we will be fine.
I am a newbie. I followed these instructions and I am not getting the login form. where do I add that ?
ReplyDeleteThis comment has been removed by the author.
ReplyDelete