changeset 795:a6b39838353f

browser_side: inform the user that entering a full JID in the login box is only needed for external XMPP account
author souliane <souliane@mailoo.org>
date Tue, 08 Dec 2015 15:11:02 +0100
parents 6a2fd7807770
children fad9c9f82ae3
files src/browser/public/libervia.css src/browser/sat_browser/register.py
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/public/libervia.css	Mon Dec 07 21:21:44 2015 +0100
+++ b/src/browser/public/libervia.css	Tue Dec 08 15:11:02 2015 +0100
@@ -410,11 +410,15 @@
 
 .formWarning { /* used when a form is not valid and must be corrected before submission */
     font-weight: bold;
-    color: red !important;
-    height: 30px;
+    color: lightcoral !important;
+    height: 45px;
     text-align: center;
 }
 
+.formInfo { /* used when a form is being edited and we want to tell something to the user */
+    color: lightcyan !important;
+}
+
 .contactsChooser {
     text-align: center;
     margin:auto;
--- a/src/browser/sat_browser/register.py	Mon Dec 07 21:21:44 2015 +0100
+++ b/src/browser/sat_browser/register.py	Tue Dec 08 15:11:02 2015 +0100
@@ -45,6 +45,9 @@
 from constants import Const as C
 
 
+KEY_AROBASE = 81  # XXX: this is the keycode for onKeyUp, the one which works for onKeyPress is 64!
+
+
 class RegisterPanel(FormPanel):
 
     def __init__(self, callback):
@@ -148,6 +151,7 @@
             self.register_login_box.setFocus(True)
 
     def onKeyPress(self, sender, keycode, modifiers):
+        # XXX: this is triggered before the textbox value has changed
         if keycode == KEY_ENTER:
             # Browsers offer an auto-completion feature to any
             # text box, but the selected value is not set when
@@ -165,7 +169,12 @@
                 self.onRegister(None)
 
     def onKeyUp(self, sender, keycode, modifiers):
-        pass
+        # XXX: this is triggered after the textbox value has changed
+        if sender == self.login_box:
+            if keycode == KEY_AROBASE:
+                self.login_warning_msg.setHTML(_('<span class="formInfo">Entering a full JID is only needed to connect with an external XMPP account.</span>'))
+            elif "@" not in self.login_box.getText():
+                self.login_warning_msg.setHTML("")
 
     def onKeyDown(self, sender, keycode, modifiers):
         pass