Passwd 4 hook problem
"Kinglok, Fong" <[email protected]> Sun, 20 Nov 2011 02:20:23 +0800
| Newsgroups | gmane.comp.horde.sork |
|---|---|
| Message-ID | <CAMEM8FLEk5QpQPKVMSkSpTSpwiY4kG1QuWajPcZ6isx-3hTMoA@mail.gmail.com> |
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? 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]