From 5a30653024528988f77ac89d6206c22cadc454b3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Tue, 26 Jan 2016 14:54:57 -0500 Subject: [PATCH] Enigma: Don't display "bad password" warning when the password wasn't provided yet --- plugins/enigma/lib/enigma_ui.php | 12 +++++++----- plugins/enigma/localization/en_US.inc | 2 ++ plugins/enigma/lib/enigma_engine.php | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php index 98f932e..36693bd 100644 --- a/plugins/enigma/lib/enigma_engine.php +++ b/plugins/enigma/lib/enigma_engine.php @@ -198,7 +198,7 @@ if ($result !== true) { if ($result->getCode() == enigma_error::BADPASS) { // ask for password - $error = array('missing' => array($key->id => $key->name)); + $error = array('bad' => array($key->id => $key->name)); return new enigma_error(enigma_error::BADPASS, '', $error); } diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php index 19f1629..dfdacc7 100644 --- a/plugins/enigma/lib/enigma_ui.php +++ b/plugins/enigma/lib/enigma_ui.php @@ -780,7 +780,9 @@ $this->enigma->gettext('decryptnokey'))); } else if ($code == enigma_error::BADPASS) { - $msg = rcube::Q($this->enigma->gettext('decryptbadpass')); + $missing = $status->getData('missing'); + $label = 'decrypt' . (!empty($missing) ? 'no' : 'bad') . 'pass'; + $msg = rcube::Q($this->enigma->gettext($label)); $this->password_prompt($status); } else { @@ -946,16 +948,16 @@ $msg = 'enigma.' . $mode . 'nokey'; } else if ($code == enigma_error::BADPASS) { - $msg = 'enigma.' . $mode . 'badpass'; - $type = 'warning'; - $this->password_prompt($status); } else { $msg = 'enigma.' . $mode . 'error'; } - $this->rc->output->show_message($msg, $type ?: 'error', $vars); + if ($msg) { + $this->rc->output->show_message($msg, $type ?: 'error', $vars); + } + $this->rc->output->send('iframe'); } diff --git a/plugins/enigma/localization/en_US.inc b/plugins/enigma/localization/en_US.inc index 5d618be..817b323 100644 --- a/plugins/enigma/localization/en_US.inc +++ b/plugins/enigma/localization/en_US.inc @@ -93,9 +93,11 @@ $messages['decrypterror'] = 'Decryption failed.'; $messages['decryptnokey'] = 'Decryption failed. Private key not found. Key ID: $keyid.'; $messages['decryptbadpass'] = 'Decryption failed. Bad password.'; +$messages['decryptnopass'] = 'Decryption failed. Key password required.'; $messages['signerror'] = 'Signing failed.'; $messages['signnokey'] = 'Signing failed. Private key not found.'; $messages['signbadpass'] = 'Signing failed. Bad password.'; +$messages['signnopass'] = 'Signing failed. Key password required.'; $messages['encrypterror'] = 'Encryption failed.'; $messages['encryptnokey'] = 'Encryption failed. Public key not found for $email.'; $messages['nokeysfound'] = 'No keys found'; -- Gitblit v1.9.1