/** * listener which gets invoked if password is changed within owncloud * * @param unknown $params * userdata */ public static function changePasswordListener($params) { $username = $params['uid']; $password = $params['password']; // Try to fetch from session $oldPrivKey = OC_RoundCube_App::getSessionVariable(OC_RoundCube_App::SESSION_ATTR_RCPRIVKEY); // Take the chance to alter the priv/pubkey pair OC_RoundCube_App::generateKeyPair($username, $password); $privKey = OC_RoundCube_App::getPrivateKey($username, $password); $pubKey = OC_RoundCube_App::getPublicKey($username); if ($oldPrivKey !== false) { // Fetch credentials from data-base $mail_userdata_entries = OC_RoundCube_App::checkLoginData($username); foreach ($mail_userdata_entries as $mail_userdata) { $mail_username = OC_RoundCube_App::decryptMyEntry($mail_userdata['mail_user'], $oldPrivKey); $mail_password = OC_RoundCube_App::decryptMyEntry($mail_userdata['mail_password'], $oldPrivKey); OC_RoundCube_App::cryptEmailIdentity($username, $mail_username, $mail_password); OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->changePasswordListener():' . 'Updated mail password data due to password changed for user ' . $username, OCP\Util::DEBUG); } } else { OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->changePasswordListener():' . 'No private key for ' . $username, OCP\Util::DEBUG); } }