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 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

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');
         }
 

--
Gitblit v1.9.1