class _LoginWindow(QtGui.QWidget): def __init__(self, api, parent=None): QtGui.QWidget.__init__(self, parent) self.api = api # Set up user interface from designer self.login_form = Ui_Login_form() self.login_form.setupUi(self) self.alive = True # Since this runs before the main app loop, we need to signal the update loop when we're done # Connect buttons etc. self.login_form.btn_cancel.clicked.connect(self.btn_login_cancel) self.login_form.btn_ok.clicked.connect(self.btn_login_ok) self.login_form.ln_username.returnPressed.connect(self.btn_login_ok) self.login_form.ln_password.returnPressed.connect(self.btn_login_ok) def btn_login_cancel(self): exit(0) def btn_login_ok(self): self.userdata = {} self.userdata["email"] = self.login_form.ln_username.text() self.userdata["password"] = self.login_form.ln_password.text() self.response = self.api._getBasicURI("user/login", values=self.userdata) # If we end up being redirected back to login, # the login failed. if "Password" in str(self.response.text): error = QtGui.QMessageBox.critical( self, "Login failed", "Frontier rejected the username / password.\nPlease try again.", buttons=QtGui.QMessageBox.Ok, ) self.login_form.ln_password.clear() return # Check to see if we need to do the auth token dance. if str(self.response.url).endswith("user/confirm"): self.alive = False self.close() self.token = _Verify_Token(self.api, self.userdata) self.token.show() self.response = self.token.response
def __init__(self, api, parent=None): QtGui.QWidget.__init__(self, parent) self.api = api # Set up user interface from designer self.login_form = Ui_Login_form() self.login_form.setupUi(self) self.alive = True # Since this runs before the main app loop, we need to signal the update loop when we're done # Connect buttons etc. self.login_form.btn_cancel.clicked.connect(self.btn_login_cancel) self.login_form.btn_ok.clicked.connect(self.btn_login_ok) self.login_form.ln_username.returnPressed.connect(self.btn_login_ok) self.login_form.ln_password.returnPressed.connect(self.btn_login_ok)