From dc1913b99f5e51e9d204ccfdbc639da6b3babc81 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sat, 7 Jan 2012 15:41:53 +0100
Subject: [PATCH] [Pablo Mazzini] ask passphrase to user when using non-sasl
 authentication

---
 src/common/xmpp/auth_nb.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/common/xmpp/auth_nb.py b/src/common/xmpp/auth_nb.py
index dd7d13097a..71b5db8a1c 100644
--- a/src/common/xmpp/auth_nb.py
+++ b/src/common/xmpp/auth_nb.py
@@ -567,8 +567,19 @@ class NonBlockingNonSASL(PlugIn):
         else:
             log.warn("Secure methods unsupported, performing plain text \
                 authentication")
-            query.setTagData('password', self.password)
             self._method = 'plain'
+            self._owner._caller.get_password(self._on_password, self._method)
+            return
+        resp = self.owner.Dispatcher.SendAndWaitForResponse(iq,
+            func=self._on_auth)
+
+    def _on_password(self, password):
+        self.password = '' if password is None else password
+        iq=Iq('set', NS_AUTH)
+        query = iq.getTag('query')
+        query.setTagData('username', self.user)
+        query.setTagData('resource', self.resource)
+        query.setTagData('password', self.password)
         resp = self.owner.Dispatcher.SendAndWaitForResponse(iq,
             func=self._on_auth)
 
-- 
GitLab