From 3afa5df6472b83d92bfcbd60f82c3ac831474856 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Thu, 8 Mar 2018 16:37:39 +0100 Subject: [PATCH] fix broken registration --- UI/registration.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/UI/registration.py b/UI/registration.py index f89e1eb..865fadc 100644 --- a/UI/registration.py +++ b/UI/registration.py @@ -20,7 +20,8 @@ def __init__(self, parent=None): self.register_ui.password.setEchoMode(QtGui.QLineEdit.Password) self.register_ui.password_2.setEchoMode(QtGui.QLineEdit.Password) - QtCore.QObject.connect(self.register_ui.register_bt, QtCore.SIGNAL("clicked()"), + QtCore.QObject.connect(self.register_ui.register_bt, + QtCore.SIGNAL('clicked()'), self.register) # validate and register user def register(self): @@ -30,37 +31,40 @@ def register(self): self.password_repeat = self.register_ui.password_2.text() self.bridge_api_url = str(self.register_ui.bridge_url.text()).strip() # get bridge api url - if self.bridge_api_url == "": + if len(self.bridge_api_url) < 6: # xxx.yy self.bridge_api_url = 'https://api.storj.io/' self.tools = Tools() success = False - if self.email != "" and self.password != "" and self.password_repeat != "": + if self.email != '' and self.password != '' and self.password_repeat != '': if self.password == self.password_repeat: if (self.tools.check_email(self.email)): # take login action try: - self.storj_client = storj.Client(None, "", api_url=self.bridge_api_url).user_create(str(self.email).strip(), str(self.password).strip()) + self.storj_client = storj.Client(None, '', storj_bridge=self.bridge_api_url).user_create(str(self.email).strip(), str(self.password).strip()) success = True except storj.exception.StorjBridgeApiError as e: j = json.loads(str(e)) - if j[0]["error"] == "Email is already registered": - QtGui.QMessageBox.about(self, "Warning", - "User with this e-mail is \ + if j[0]['error'] == 'Email is already registered': + QtGui.QMessageBox.about(self, 'Warning', + 'User with this e-mail is \ already registered! Please \ login or try a different \ - e-mail!") + e-mail!') else: - QtGui.QMessageBox.about(self, "Unhandled exception", "Exception: " + str(e)) + QtGui.QMessageBox.about(self, 'Unhandled exception', + 'Exception: ' + str(e)) else: - QtGui.QMessageBox.about(self, "Warning", - "Your e-mail seems to be invalid! Please check e-mail and try again") + QtGui.QMessageBox.about(self, 'Warning', 'Your e-mail \ + seems to be invalid! Please check \ + e-mail and try again') else: - QtGui.QMessageBox.about(self, "Warning", - "Given passwords are different! Please check and try again!") + QtGui.QMessageBox.about(self, 'Warning', + 'Given passwords are different! Please\ + check and try again!') else: - QtGui.QMessageBox.about(self, "Warning", - "Please fill out all fields!") + QtGui.QMessageBox.about(self, 'Warning', + 'Please fill out all fields!') if success: msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Information, "Success",