Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
480:50b286866739 | 481:bbdc5357dc00 |
---|---|
206 def onSubmit(self, event): | 206 def onSubmit(self, event): |
207 pass | 207 pass |
208 | 208 |
209 def onSubmitComplete(self, event): | 209 def onSubmitComplete(self, event): |
210 result = event.getResults() | 210 result = event.getResults() |
211 if result == "PROFILE AUTH ERROR": | 211 if result == C.PROFILE_AUTH_ERROR: |
212 Window.alert(_('Your login and/or password is incorrect. Please try again')) | 212 Window.alert(_('Your login and/or password is incorrect. Please try again')) |
213 elif result == "XMPP AUTH ERROR": | 213 elif result == C.XMPP_AUTH_ERROR: |
214 # TODO: call stdui action CHANGE_XMPP_PASSWD_ID as it's done in primitivus | 214 # TODO: call stdui action CHANGE_XMPP_PASSWD_ID as it's done in primitivus |
215 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.')) | 215 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.')) |
216 elif result == "LOGGED": | 216 elif result == C.PROFILE_LOGGED: |
217 self.callback() | 217 self.callback() |
218 elif result == "SESSION_ACTIVE": | 218 elif result == C.SESSION_ACTIVE: |
219 Window.alert(_('Session already active, this should not happen, please contact the author to fix it')) | 219 Window.alert(_('Session already active, this should not happen, please contact the author to fix it')) |
220 elif result == "ALREADY EXISTS": | 220 elif result == C.NO_REPLY: |
221 Window.alert(_("Did not receive a reply (the timeout expired or the connection is broken)")) | |
222 elif result == C.ALREADY_EXISTS: | |
221 self.register_warning_msg.setHTML(_('This login already exists,<br>please choose another one')) | 223 self.register_warning_msg.setHTML(_('This login already exists,<br>please choose another one')) |
222 self.register_warning_msg.setVisible(True) | 224 self.register_warning_msg.setVisible(True) |
223 elif result == "INTERNAL": | 225 elif result == C.INTERNAL_ERROR: |
224 self.register_warning_msg.setHTML(_('SERVER ERROR: something went wrong during registration process, please contact the server administrator')) | 226 self.register_warning_msg.setHTML(_('SERVER ERROR: something went wrong during registration process, please contact the server administrator')) |
225 self.register_warning_msg.setVisible(True) | 227 self.register_warning_msg.setVisible(True) |
226 elif result == "REGISTRATION": | 228 elif result == C.REGISTRATION_SUCCEED: |
227 self.login_warning_msg.setVisible(False) | 229 self.login_warning_msg.setVisible(False) |
228 self.register_warning_msg.setVisible(False) | 230 self.register_warning_msg.setVisible(False) |
229 self.login_box.setText(self.register_login_box.getText()) | 231 self.login_box.setText(self.register_login_box.getText()) |
230 self.login_pass_box.setText('') | 232 self.login_pass_box.setText('') |
231 self.register_login_box.setText('') | 233 self.register_login_box.setText('') |