def btnRegister(btn): def isLoginLegal(username, password): if len(username) > 3 and len(password) > 3: return True else: alertMessageDialog(msg='La salutnomo kaj pasvorto devas esti pli longa ol 3 karaktroj', title='Eraro okazis') def isStringLegal(string): restricted = u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ĉĈĝĜĥĤĵĴŝŜŭŬ' for i in range(len(string)): if string[i] not in restricted: # todo: msgbox (not valid) alertMessageDialog(msg=u'La nomo nevalidas. Ĝi devas enhavi nur tiujn karaktrojn: [a-z], [ĉĝĥĵŝŭ], kaj [0-9].', title='Eraro okazis') return False return True def checkPasswords(password1, password2): if password1 == password2: return True username = self.value.items()[0][1] password = self.value.items()[1][1] passwordConfirm = self.value.items()[2][1] if isLoginLegal(username, password): if checkPasswords(password, passwordConfirm): if isStringLegal(username): g.tcpConn.sendNewAccount(username, password) else: # todo: msgbox alertMessageDialog(msg='La pasvortoj ne kongruas.', title='Eraro okazis')
def btnRegister(btn): def isLoginLegal(username, password): if len(username) > 3 and len(password) > 3: return True else: alertMessageDialog(msg='Username and password must be larger than 3 characters.', title='An error occured') def isStringLegal(string): restricted = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' for i in range(len(string)): if string[i] not in restricted: # todo: msgbox (not valid) alertMessageDialog(msg='The name is not valid! The name may only contain a-z and 0-9.', title='An error occured') return False return True def checkPasswords(password1, password2): if password1 == password2: return True username = self.value.items()[0][1] password = self.value.items()[1][1] passwordConfirm = self.value.items()[2][1] if isLoginLegal(username, password): if checkPasswords(password, passwordConfirm): if isStringLegal(username): g.tcpConn.sendNewAccount(username, password) else: # todo: msgbox alertMessageDialog(msg='The passwords don\'t match.', title='An error occured')
def isLoginLegal(username, password): if len(username) > 3 and len(password) > 3: return True else: alertMessageDialog( msg= 'Username and password must be larger than 3 characters.', title='An error occured')
def isStringLegal(self, string): restricted = u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ĉĈĝĜĥĤĵĴŝŜŭŬ' for i in range(len(string)): if string[i] not in restricted: alertMessageDialog(msg=_(u'La nomo nevalidas. Ĝi devas enhavi nur tiujn karaktrojn: [a-z], [ĉĝĥĵŝŭ], kaj [0-9].'), title=_('Eraro okazis')) return False return True
def isStringLegal(self, string): restricted = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' for i in range(len(string)): if string[i] not in restricted: alertMessageDialog(msg='The name is not valid! The name may only contain a-z and 0-9.', title='An error occured') return False return True
def clientConnectionFailed(self, connector, reason): errorMsg = reason.getErrorMessage().split(':') alertMessageDialog('Unable to connect to server: ' + errorMsg[1] + errorMsg[2], 'An error occured') print reason.getErrorMessage()
def isLoginLegal(username, password): if len(username) > 3 and len(password) > 3: return True else: alertMessageDialog(msg='La salutnomo kaj pasvorto devas esti pli longa ol 3 karaktroj', title='Eraro okazis')
def isLoginLegal(username, password): if len(username) > 3 and len(password) > 3: return True else: alertMessageDialog(msg='Username and password must be larger than 3 characters.', title='An error occured')
def handleAlertMsg(self, jsonData): msg = jsonData[0]['msg'] alertMessageDialog(msg=msg)
def handleAlertMsg(self, jsonData): msg = jsonData[0]['msg'] creatingAccount = 'Your account has been created!' alertMessageDialog(msg=msg)