fix(auth): IMP server selector missing on login page unless auth driver is 'application'#136
Conversation
LoginService::buildLoginFormData() and login.php's equivalent inline code only resolved extra login form fields (e.g. IMP's server selector) through the primary Horde auth driver instance. With auth.driver = 'application' pointed at imp, this worked because 'horde' auth delegates directly to 'imp'. With any other driver (LDAP, SQL, etc.), IMP's authLoginParams() was never consulted, silently dropping the server selector even when $conf['server']['server_list'] = 'shown'. Both login.php and LoginService now additionally resolve IMP's login params via the new 'loginparams' auth capability (see horde/imp), independently of which driver authenticates the user to Horde itself.
|
Thanks for the PR and the detailed root-cause analysis! I reviewed this together with the companion horde/imp#91. I agree there is a real bug here, but I see two problems with the approach, and I believe the actual root cause is a one-line omission elsewhere. 1. The selector renders, but the selection is ignoredThis PR patches only the form-display paths (
So in the configurations this PR targets, a user would pick "Server B" on the login screen and silently be connected to Server A. That is arguably worse than not showing the selector. 2. Hardcoding
|
Bug
When multiple IMAP backends are configured in
backends.phpwith$conf['server']['server_list'] = 'shown'(imp), the server selector dropdown never appears on the login page — unless the Horde auth driver is specificallyapplicationpointed atimp.Root cause
LoginService::buildLoginFormData()(andlogin.php's equivalent inline code) resolves extra login form fields via$auth->getLoginParams(), using the auth driver instance for the'horde'app only.IMP_Application::authLoginParams()— which builds the server selector — is only reachable through this path when$conf['auth']['driver'] = 'application'withparams.app = 'imp', since in that configuration'horde'auth delegates directly to'imp'.With any other driver (LDAP, SQL, etc.), IMP's login params are never consulted at all, silently dropping the server selector.
Fix
Add a
'loginparams'auth capability, declared byIMP_Application::$auth(mirroring the existing'add','transparent', etc. capabilities).LoginService/login.phpnow additionally resolve IMP's login params via this capability, independently of which driver authenticates the user to Horde itself.Depends on the companion change in horde/imp declaring the
'loginparams'capability.Testing
Verified the server selector now appears on both
/login.phpand the responsive/auth/loginroute withauth.driver = ldapand multiple non-disabled backends inbackends.php.