Mercurial > libervia-web
diff src/browser/sat_browser/register.py @ 481:bbdc5357dc00
browser and server sides: refactor HTTP request result values + handle "NoReply" error
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 15 Jun 2014 17:52:08 +0200 |
parents | 97c72fe4a5f2 |
children | e588335b6aa8 |
line wrap: on
line diff
--- a/src/browser/sat_browser/register.py Sat Jun 14 19:20:27 2014 +0200 +++ b/src/browser/sat_browser/register.py Sun Jun 15 17:52:08 2014 +0200 @@ -208,22 +208,24 @@ def onSubmitComplete(self, event): result = event.getResults() - if result == "PROFILE AUTH ERROR": + if result == C.PROFILE_AUTH_ERROR: Window.alert(_('Your login and/or password is incorrect. Please try again')) - elif result == "XMPP AUTH ERROR": + elif result == C.XMPP_AUTH_ERROR: # TODO: call stdui action CHANGE_XMPP_PASSWD_ID as it's done in primitivus Window.alert(_(u'Your SàT profile has been authenticated but the associated XMPP account failed to connect. Please use another SàT frontend to set another XMPP password.')) - elif result == "LOGGED": + elif result == C.PROFILE_LOGGED: self.callback() - elif result == "SESSION_ACTIVE": + elif result == C.SESSION_ACTIVE: Window.alert(_('Session already active, this should not happen, please contact the author to fix it')) - elif result == "ALREADY EXISTS": + elif result == C.NO_REPLY: + 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')) self.register_warning_msg.setVisible(True) - elif result == "INTERNAL": + elif result == C.INTERNAL_ERROR: self.register_warning_msg.setHTML(_('SERVER ERROR: something went wrong during registration process, please contact the server administrator')) self.register_warning_msg.setVisible(True) - elif result == "REGISTRATION": + elif result == C.REGISTRATION_SUCCEED: self.login_warning_msg.setVisible(False) self.register_warning_msg.setVisible(False) self.login_box.setText(self.register_login_box.getText())