Re: Passwd 4 hook problem
Jan Schneider <[email protected]> Sun, 20 Nov 2011 15:01:28 +0100
| Newsgroups | gmane.comp.horde.sork |
|---|---|
| Message-ID | <[email protected]> |
Zitat von "Kinglok, Fong" <[email protected]>: > I am using horde 4.0.11, IMP 5.0.14. Horde authentication is done by SQL. > I also make use of horde username hook. IMP login is done by configuring > the backends.php. > > I would like to use Passwd to update both passwords of horde and email > backend (running vpopmail). Therefore, horde (user) and vpopmail ( > [email protected]) have to be updated in the same time. It seems me that > hook of Passwd must be used. > > My method is to strip the domain from $userid in function username and then > add the domain back if the backend is 'expect'. > > However, the screen just turn white whenever I try to reset a user's > password. After some investigation, I believe the problem is from the > statement: foreach ($driver->_params['drivers'] as $backend => > $config) { > > Any comment? http://wiki.horde.org/FAQ/Admin/Troubleshoot#wsod Though it shouldn't be necessary to go through all composited drivers in the hook. At least I would say it's a bug if you have to. > Kinglok, Fong > > */var/www/html/webmail/passwd/hook.php* > ================================= > class Passwd_Hooks > { > /** > * Username hook. > * > * @param string $userid The username. > * @param TODO $driver TODO > * > * @return string TODO > */ > public function username($userid, $driver) > { > * $userid = substr($userid,0,strpos($userid,"@")); > * > if ($driver instanceof Passwd_Driver_Expect) { > return $userid . '@example.com'; > } > > if ($driver instanceof Passwd_Driver_Composite) { > foreach ($driver->_params['drivers'] as $backend => $config) { > if ($backend == 'expect') { > > $driver->_params['drivers']['expect']['params']['be_username'] = $userid . > '@example.com'; > break; > } > } > } > return $userid; > } > } > ============================================= > > */var/www/html/webmail/passwd/backends.php* > ======================== > <?php > $backends['composite'] = array( > 'name' => 'All Services', > 'preferred' => '', > 'password policy' => array( > 'minLength' => 3, > 'maxLength' => 20, > //'minClasses' => 2, > ), > 'driver' => 'composite', > 'params' => array( > 'drivers' => array( > 'sql' => array( > 'name' => 'Horde Authentication', > 'driver' => 'Sql', > 'required' => true, > 'params' => array( > 'phptype' => 'mysql', > 'hostspec' => 'localhost', > 'username' => 'hordeuser', > 'password' => 'XXXXXXXXXXX', > 'encryption' => 'plain', > 'database' => 'horde4', > 'table' => 'horde_users', > 'user_col' => 'user_uid', > 'pass_col' => 'user_pass', > 'show_encryption' => false > // 'query_lookup' => '', > // 'query_modify' => '', > ), > ), > 'expect' => array( > 'name' => 'Webmail Password', > 'preferred' => '', > 'driver' => 'expect', > 'required' => true, > 'params' => array( > 'program' => '/usr/bin/expect', > 'script' => dirname(__FILE__) . > '/../scripts/vpopmail_cdb_expect', > 'be_username' => '', > ), > ), > } > } > } > -- > Sork mailing list - Join the hunt: http://horde.org/bounties/#sork > Frequently Asked Questions: http://horde.org/faq/ > To unsubscribe, mail: [email protected] Jan. -- Do you need professional PHP or Horde consulting? http://horde.org/consulting/ -- Sork mailing list - Join the hunt: http://horde.org/bounties/#sork Frequently Asked Questions: http://horde.org/faq/ To unsubscribe, mail: [email protected]