Description
I'm integrating LDAP authentication into my py4web app using py4web.utils.auth_plugins.ldap_plugin.LDAPPlugin, connected to an Active Directory server.
Here's some issues I encountered along the way:
❗ Issues Encountered:
LDAPPlugin.__init__()
got an unexpected keyword argument 'use_tls'
→ Removed use_tls
& timeout
keys to make it work.
Default login page rendered only a single blank input with no labels
→ It seems the default auth.login()
template doesn't render LDAP-based fields properly.
Auth.login() raises:
TypeError:
Auth.login() missing 2 required positional arguments: 'email' and 'password'
→ I expected a form, not a function call.
💡 What Worked:
Using:
@action('index')
@action.uses('index.html', auth.user)
def index():
user = auth.get_user()
return dict(message=f"Hello {user['username']}")
Adding auth.use_username = True in common.py
Avoiding manual call to auth.login() in a controller (let py4web handle it via /auth/login route)
🙋♂️ Questions:
Is there a canonical way to render a working login form with LDAP (e.g., username/password)?
Is there a recommended template override or plugin fix for better LDAP support?
Are there plans to improve the docs around LDAPPlugin?
Thanks for the amazing work on py4web! I'd be happy to contribute improved docs/examples for LDAP if needed.