예제 #1
0
 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)
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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)
예제 #8
0
 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
예제 #9
0
 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)
예제 #10
0
 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
예제 #11
0
파일: __init__.py 프로젝트: kblw/wot_client
 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
예제 #12
0
 def isPwdInvalid(self, password):
     isInvalid = False
     if not constants.IS_DEVELOPMENT and not self._loginMode.isToken2():
         isInvalid = not isPasswordValid(password)
     return isInvalid
예제 #13
0
 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
예제 #14
0
 def isPwdInvalid(self, password):
     isInvalid = False
     if not constants.IS_DEVELOPMENT and not self.loginManager.getPreference('token2'):
         isInvalid = not isPasswordValid(password)
     return isInvalid