Passphrase input fixes
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 31 Mar 2010 22:27:24 +0000 (16:27 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 31 Mar 2010 22:41:33 +0000 (16:41 -0600)
framework/Ajax/lib/Horde/Ajax/Imple/Base.php
imp/lib/Ajax/Imple/PassphraseDialog.php
imp/lib/Crypt/Pgp.php

index 0e60bbc..ee14297 100644 (file)
@@ -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;
 
index e0abbb0..b81903e 100644 (file)
@@ -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);
     }
 
     /**
index 6ecdd18..c271a99 100644 (file)
@@ -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) {