changeset 1164:ef3adc3f2078

handle invalid certificate on registration + fixed error handling on registration
author Goffi <goffi@goffi.org>
date Sun, 03 Mar 2019 17:14:27 +0100
parents cd6dd7f66551
children 6424d3684d1e
files browser/sat_browser/register.py libervia/common/constants.py libervia/server/server.py
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/browser/sat_browser/register.py	Sat Mar 02 18:44:20 2019 +0100
+++ b/browser/sat_browser/register.py	Sun Mar 03 17:14:27 2019 +0100
@@ -221,6 +221,8 @@
             Window.alert(_("Did not receive a reply (the timeout expired or the connection is broken)."))
         elif result == C.ALREADY_EXISTS:
             self.register_warning_msg.setHTML(_('This login already exists,<br>please choose another one.'))
+        elif result == C.INVALID_CERTIFICATE:
+            self.register_warning_msg.setHTML(_('The certificate of the server is invalid,<br>please contact your server administrator.'))
         elif result == C.INTERNAL_ERROR:
             self.register_warning_msg.setHTML(_('An registration error occurred, please contact the server administrator.'))
         elif result == C.REGISTRATION_SUCCEED:
--- a/libervia/common/constants.py	Sat Mar 02 18:44:20 2019 +0100
+++ b/libervia/common/constants.py	Sun Mar 03 17:14:27 2019 +0100
@@ -44,6 +44,7 @@
     PROFILE_LOGGED = "LOGGED"
     PROFILE_LOGGED_EXT_JID = "LOGGED (REGISTERED WITH EXTERNAL JID)"
     ALREADY_EXISTS = "ALREADY EXISTS"
+    INVALID_CERTIFICATE = "INVALID CERTIFICATE"
     REGISTRATION_SUCCEED = "REGISTRATION"
     INTERNAL_ERROR = "INTERNAL ERROR"
     INVALID_INPUT = "INVALID INPUT"
--- a/libervia/server/server.py	Sat Mar 02 18:44:20 2019 +0100
+++ b/libervia/server/server.py	Sun Mar 03 17:14:27 2019 +0100
@@ -2373,9 +2373,12 @@
             return C.REGISTRATION_SUCCEED
 
         def registeringError(failure):
-            status = failure.value.faultString
+            # FIXME: better error handling for bridge error is needed
+            status = failure.value.fullname.split('.')[-1]
             if status == "ConflictError":
                 return C.ALREADY_EXISTS
+            elif status == "InvalidCertificate":
+                return C.INVALID_CERTIFICATE
             elif status == "InternalError":
                 return C.INTERNAL_ERROR
             else: