From 82ed1890bd98c37f2740a782f9eab123e5e50c0c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 31 Mar 2010 16:27:24 -0600 Subject: [PATCH] Passphrase input fixes --- framework/Ajax/lib/Horde/Ajax/Imple/Base.php | 4 +++- imp/lib/Ajax/Imple/PassphraseDialog.php | 14 +++++++------- imp/lib/Crypt/Pgp.php | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/framework/Ajax/lib/Horde/Ajax/Imple/Base.php b/framework/Ajax/lib/Horde/Ajax/Imple/Base.php index 0e60bbc9d..ee14297cf 100644 --- a/framework/Ajax/lib/Horde/Ajax/Imple/Base.php +++ b/framework/Ajax/lib/Horde/Ajax/Imple/Base.php @@ -47,10 +47,12 @@ abstract class Horde_Ajax_Imple_Base * @param string $driver * @param string $app * @param array $params + * @param boolean $full * * @return string */ - protected function _getUrl($driver, $app = 'horde', $params = array(), $full = false) + protected function _getUrl($driver, $app = 'horde', $params = array(), + $full = false) { $qstring = 'imple=' . $driver; diff --git a/imp/lib/Ajax/Imple/PassphraseDialog.php b/imp/lib/Ajax/Imple/PassphraseDialog.php index e0abbb0c6..b81903ec6 100644 --- a/imp/lib/Ajax/Imple/PassphraseDialog.php +++ b/imp/lib/Ajax/Imple/PassphraseDialog.php @@ -85,7 +85,7 @@ class IMP_Ajax_Imple_PassphraseDialog extends Horde_Ajax_Imple_Base 'password' => true, 'text' => $text, 'type' => $this->_params['type'], - 'uri' => strval($this->_getUrl('PassphraseDialog', 'imp')) + 'uri' => strval($this->_getUrl('PassphraseDialog', 'imp', array('sessionWrite' => 1))) ); Horde::addScriptFile('effects.js', 'horde'); @@ -132,12 +132,12 @@ class IMP_Ajax_Imple_PassphraseDialog extends Horde_Ajax_Imple_Base switch ($vars->type) { case 'pgpPersonal': case 'pgpSymmetric': - if ($this->_vars->dialog_input) { + if ($vars->dialog_input) { $imp_pgp = $GLOBALS['injector']->getInstance('IMP_Crypt_Pgp'); if ((($vars->type == 'pgpPersonal') && - $imp_pgp->storePassphrase('personal', $this->_vars->dialog_input)) || + $imp_pgp->storePassphrase('personal', $vars->dialog_input)) || (($vars->type == 'pgpSymmeetric') && - $imp_pgp->storePassphrase('symmetric', $this->_vars->dialog_input, $this->_vars->symmetricid))) { + $imp_pgp->storePassphrase('symmetric', $vars->dialog_input, $vars->symmetricid))) { $result->success = 1; } else { $result->error = _("Invalid passphrase entered."); @@ -148,9 +148,9 @@ class IMP_Ajax_Imple_PassphraseDialog extends Horde_Ajax_Imple_Base break; case 'smimePersonal': - if ($this->_vars->dialog_input) { + if ($vars->dialog_input) { $imp_smime = $GLOBALS['injector']->getInstance('IMP_Crypt_Smime'); - if ($imp_smime->storePassphrase($this->_vars->dialog_input)) { + if ($imp_smime->storePassphrase($vars->dialog_input)) { $result->success = 1; } else { $result->error = _("Invalid passphrase entered."); @@ -164,7 +164,7 @@ class IMP_Ajax_Imple_PassphraseDialog extends Horde_Ajax_Imple_Base $result->error = $e->getMessage(); } - return $result; + return Horde::prepareResponse($result); } /** diff --git a/imp/lib/Crypt/Pgp.php b/imp/lib/Crypt/Pgp.php index 6ecdd181a..c271a9981 100644 --- a/imp/lib/Crypt/Pgp.php +++ b/imp/lib/Crypt/Pgp.php @@ -408,7 +408,7 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp * * @return boolean Returns true if correct passphrase, false if incorrect. */ - public function storePassphrase($type, $passphrase, $id) + public function storePassphrase($type, $passphrase, $id = null) { if ($type == 'personal') { if ($this->verifyPassphrase($this->getPersonalPublicKey(), $this->getPersonalPrivateKey(), $passphrase) === false) { -- 2.11.0