def __validateCredentials(self, userName, password, isToken2Login): isValid = True errorMessage = None invalidFields = None if isToken2Login or constants.IS_DEVELOPMENT: return _ValidateCredentialsResult(isValid, errorMessage, invalidFields) else: if len(userName) < _LOGIN_NAME_MIN_LENGTH: isValid = False errorMessage = _ms(MENU.LOGIN_STATUS_INVALID_LOGIN_LENGTH, count=_LOGIN_NAME_MIN_LENGTH) invalidFields = INVALID_FIELDS.LOGIN_INVALID elif not isAccountLoginValid(userName): isValid = False errorMessage = _ms(MENU.LOGIN_STATUS_INVALID_LOGIN) invalidFields = INVALID_FIELDS.LOGIN_INVALID elif not isPasswordValid(password): isValid = False errorMessage = _ms(MENU.LOGIN_STATUS_INVALID_PASSWORD, minLength=_PASSWORD_MIN_LENGTH, maxLength=_PASSWORD_MAX_LENGTH) invalidFields = INVALID_FIELDS.PWD_INVALID return _ValidateCredentialsResult(isValid, errorMessage, invalidFields)
def isPwdInvalid(self, password): isInvalid = False if not constants.IS_DEVELOPMENT and not self.__loginDispatcher.isToken( ): from external_strings_utils import isPasswordValid isInvalid = not isPasswordValid(password) return isInvalid
def isPwdInvalid(self, password): isInvalid = False if not constants.IS_DEVELOPMENT and not g_loginManager.getPreference( 'token2'): from external_strings_utils import isPasswordValid isInvalid = not isPasswordValid(password) return isInvalid
def onLogin(self, user, password, host, hdlr): self.__onLoggingTryingEndHdlr = hdlr self.__kickedFromServer = False if self.__closeCallbackId: BigWorld.cancelCallback(self.__closeCallbackId) self.__closeCallbackId = None if g_steamAccount.isValid: user, password = g_steamAccount.getCredentials() else: user = user.lower().strip() if len(user) < _LOGIN_NAME_MIN_LENGTH: self.onSetStatus( i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN_LENGTH) % {"count": _LOGIN_NAME_MIN_LENGTH}, self.LOGIN_INVALID, ) return if not isAccountLoginValid(user) and not constants.IS_DEVELOPMENT: self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN), self.LOGIN_INVALID) return password = password.strip() if ( not isPasswordValid(password) and not constants.IS_DEVELOPMENT and not len(self.__loginDataLoader.token2) ): self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_PASSWORD), self.LOGIN_PWD_INVALID) return Waiting.show("login") self.__loginDataLoader.host = host self.__loginDataLoader.user = user self.__loginDataLoader.passLength = len(password) if constants.IS_VIETNAM: self.__pass = password self.__loginDataLoader.saveUserConfig(user, self.__loginDataLoader.host) password = pwd_token.generate(password) if len(self.__loginDataLoader.token2): password = "" if AUTO_LOGIN_QUERY_URL == host: g_preDefinedHosts.autoLoginQuery( lambda host: connectionManager.connect( host.url, user, password, host.keyPath, nickName=None, token2=self.__loginDataLoader.token2 ) ) return else: host = g_preDefinedHosts.byUrl(host) urls = host.urlIterator if urls is not None: if urls.end(): urls.cursor = 0 host = urls.next() LOG_DEBUG("Gets next LoginApp url:", host) connectionManager.connect( host.url, user, password, host.keyPath, nickName=None, token2=self.__loginDataLoader.token2 ) return
def __validateCredentials(self, user, password): if len(user) < _LOGIN_NAME_MIN_LENGTH: self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN_LENGTH) % {'count': _LOGIN_NAME_MIN_LENGTH}, self.LOGIN_INVALID) return False if not isAccountLoginValid(user) and not constants.IS_DEVELOPMENT: self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN), self.LOGIN_INVALID) return False if not isPasswordValid(password) and not constants.IS_DEVELOPMENT and not len(self.__loginDataLoader.token2): self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_PASSWORD), self.LOGIN_PWD_INVALID) return False return True
def __validateCredentials(self, user, password): if len(user) < _LOGIN_NAME_MIN_LENGTH: self.onSetStatus( i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN_LENGTH) % {'count': _LOGIN_NAME_MIN_LENGTH}, self.LOGIN_INVALID) return False if not isAccountLoginValid(user) and not constants.IS_DEVELOPMENT: self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN), self.LOGIN_INVALID) return False if not isPasswordValid( password) and not constants.IS_DEVELOPMENT and not len( self.__loginDataLoader.token2): self.onSetStatus( i18n.makeString(MENU.LOGIN_STATUS_INVALID_PASSWORD), self.LOGIN_PWD_INVALID) return False return True
def __validateCredentials(self, userName, password, isToken2Login): result = namedtuple('ValidateCredentialsResult', ('isValid', 'errorMessage', 'invalidFields')) result.isValid = True result.errorMessage = None result.invalidFields = None if isToken2Login or constants.IS_DEVELOPMENT: return result else: if len(userName) < _LOGIN_NAME_MIN_LENGTH: result.isValid = False result.errorMessage = _ms(MENU.LOGIN_STATUS_INVALID_LOGIN_LENGTH) % {'count': _LOGIN_NAME_MIN_LENGTH} result.invalidFields = INVALID_FIELDS.LOGIN_INVALID elif not isAccountLoginValid(userName): result.isValid = False result.errorMessage = _ms(MENU.LOGIN_STATUS_INVALID_LOGIN) result.invalidFields = INVALID_FIELDS.LOGIN_INVALID elif not isPasswordValid(password): result.isValid = False result.errorMessage = _ms(MENU.LOGIN_STATUS_INVALID_PASSWORD) result.invalidFields = INVALID_FIELDS.LOGIN_PWD_INVALID return result
def onLogin(self, user, password, host, hdlr): self.__onLoggingTryingEndHdlr = hdlr self.__kickedFromServer = False self.__kickPeripheryID = None if self.__closeCallbackId: BigWorld.cancelCallback(self.__closeCallbackId) self.__closeCallbackId = None if g_steamAccount.isValid: user, password = g_steamAccount.getCredentials() else: user = user.lower().strip() if len(user) < _LOGIN_NAME_MIN_LENGTH: self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN_LENGTH) % {'count': _LOGIN_NAME_MIN_LENGTH}, self.LOGIN_INVALID) return if not isAccountLoginValid(user) and not constants.IS_DEVELOPMENT: self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN), self.LOGIN_INVALID) return password = password.strip() if not isPasswordValid(password) and not constants.IS_DEVELOPMENT and not len(self.__loginDataLoader.token2): self.onSetStatus(i18n.makeString(MENU.LOGIN_STATUS_INVALID_PASSWORD), self.LOGIN_PWD_INVALID) return Waiting.show('login') self.__loginDataLoader.host = host self.__loginDataLoader.user = user self.__loginDataLoader.passLength = len(password) if constants.IS_VIETNAM: self.__pass = password self.__loginDataLoader.saveUserConfig(user, self.__loginDataLoader.host) password = pwd_token.generate(password) if len(self.__loginDataLoader.token2): password = '' token2 = self.__loginDataLoader.token2 if AUTO_LOGIN_QUERY_URL == host: g_preDefinedHosts.autoLoginQuery(lambda host: connectionManager.connect(getHostURL(host, token2), user, password, host.keyPath, nickName=None, token2=token2, isNeedSavingPwd=self.__loginDataLoader.rememberPwd)) return host = g_preDefinedHosts.byUrl(host) connectionManager.connect(getHostURL(host, token2, True), user, password, host.keyPath, nickName=None, token2=token2, isNeedSavingPwd=self.__loginDataLoader.rememberPwd)
def onLogin(self, user, password, host, hdlr): self.__onLoggingTryingEndHdlr = hdlr self.__kickedFromServer = False if self.__closeCallbackId: BigWorld.cancelCallback(self.__closeCallbackId) self.__closeCallbackId = None if g_steamAccount.isValid: user, password = g_steamAccount.getCredentials() else: user = user.lower().strip() if len(user) < _LOGIN_NAME_MIN_LENGTH: self.onSetStatus( i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN_LENGTH) % {'count': _LOGIN_NAME_MIN_LENGTH}, self.LOGIN_INVALID) return if not isAccountLoginValid(user) and not constants.IS_DEVELOPMENT: self.onSetStatus( i18n.makeString(MENU.LOGIN_STATUS_INVALID_LOGIN), self.LOGIN_INVALID) return password = password.strip() if not isPasswordValid( password) and not constants.IS_DEVELOPMENT and not len( self.__loginDataLoader.token2): self.onSetStatus( i18n.makeString(MENU.LOGIN_STATUS_INVALID_PASSWORD), self.LOGIN_PWD_INVALID) return Waiting.show('login') self.__loginDataLoader.host = host self.__loginDataLoader.user = user self.__loginDataLoader.passLength = len(password) if constants.IS_VIETNAM: self.__pass = password self.__loginDataLoader.saveUserConfig(user, self.__loginDataLoader.host) password = pwd_token.generate(password) if len(self.__loginDataLoader.token2): password = '' if AUTO_LOGIN_QUERY_URL == host: g_preDefinedHosts.autoLoginQuery( lambda host: connectionManager.connect( host.url, user, password, host.keyPath, nickName=None, token2=self.__loginDataLoader.token2)) return else: host = g_preDefinedHosts.byUrl(host) urls = host.urlIterator if urls is not None: if urls.end(): urls.cursor = 0 host = urls.next() LOG_DEBUG('Gets next LoginApp url:', host) connectionManager.connect(host.url, user, password, host.keyPath, nickName=None, token2=self.__loginDataLoader.token2) return
def isPwdInvalid(self, password): isInvalid = False if not constants.IS_DEVELOPMENT and not self.__loginDispatcher.isToken(): from external_strings_utils import isPasswordValid isInvalid = not isPasswordValid(password) return isInvalid
def isPwdInvalid(self, password): isInvalid = False if not constants.IS_DEVELOPMENT and not self._loginMode.isToken2(): isInvalid = not isPasswordValid(password) return isInvalid
def isPwdInvalid(self, password): isInvalid = False if not constants.IS_DEVELOPMENT and not g_loginManager.getPreference('token2'): from external_strings_utils import isPasswordValid isInvalid = not isPasswordValid(password) return isInvalid
def isPwdInvalid(self, password): isInvalid = False if not constants.IS_DEVELOPMENT and not self.loginManager.getPreference('token2'): isInvalid = not isPasswordValid(password) return isInvalid