コード例 #1
0
 def onLogin(self, user, password, host, hdlr, isSocialToken2Login = False):
     self.__onLoggingTryingEndHdlr = hdlr
     self.__kickedFromServer = False
     self.__kickPeripheryID = None
     if self.__closeCallbackId:
         BigWorld.cancelCallback(self.__closeCallbackId)
         self.__closeCallbackId = None
     if not isSocialToken2Login:
         if not self.__validateCredentials(user.lower().strip(), password.strip()):
             self.__onLoggingTryingEndHdlr()
             return
     Waiting.show('login')
     self.__loginDataLoader.host = host
     self.__loginDataLoader.user = user
     self.__loginDataLoader.passLength = len(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
     else:
         host = g_preDefinedHosts.byUrl(host)
         connectionManager.connect(getHostURL(host, token2, True), user, password, host.keyPath, nickName=None, token2=token2, isNeedSavingPwd=self.__loginDataLoader.rememberPwd)
         return
コード例 #2
0
 def onTryCreateAnAccount(self, nickname):
     if len(nickname) < _ACCOUNT_NAME_MIN_LENGTH_REG:
         self.onNicknameTooSmall()
         return
     elif not isAccountNameValid(nickname):
         self.onAccountNameIsInvalid()
         return
     else:
         host = g_preDefinedHosts.byUrl(self.__loginDataLoader.host)
         password = pwd_token.generate(self.__pass)
         urls = host.urlIterator
         if urls is not None:
             if urls.end():
                 urls.cursor = 0
             host = urls.next()
             LOG_DEBUG('Gets next LoginApp url:', host)
         LOG_DEBUG(
             'Try create an account: url=%s; login=%s; password=%s; nickName=%s'
             % (host.url, self.__loginDataLoader.user, password, nickname))
         connectionManager.connect(host.url,
                                   self.__loginDataLoader.user,
                                   password,
                                   host.keyPath,
                                   nickName=nickname,
                                   token2='')
         return
コード例 #3
0
 def __connectToHost(self, host):
     connectionManager.connect(host.urlToken,
                               '',
                               '',
                               host.keyPath,
                               isNeedSavingPwd=self.__rememberMe,
                               tokenLoginParams=self.__tokenLoginParams)
コード例 #4
0
ファイル: __init__.py プロジェクト: jamesxia4/wot_client
 def __doConnect(self):
     login, token2 = self.__credentials
     self.__addHandlers()
     connectionManager.connect(getHostURL(self.__host, token2),
                               login,
                               '',
                               self.__host.keyPath,
                               token2=token2)
コード例 #5
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
コード例 #6
0
 def onLogin(self, user, password, host, hdlr, isSocialToken2Login=False):
     self.__onLoggingTryingEndHdlr = hdlr
     self.__kickedFromServer = False
     self.__kickPeripheryID = None
     if self.__closeCallbackId:
         BigWorld.cancelCallback(self.__closeCallbackId)
         self.__closeCallbackId = None
     if not isSocialToken2Login:
         if not self.__validateCredentials(user.lower().strip(),
                                           password.strip()):
             self.__onLoggingTryingEndHdlr()
             return
     Waiting.show('login')
     self.__loginDataLoader.host = host
     self.__loginDataLoader.user = user
     self.__loginDataLoader.passLength = len(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)
コード例 #7
0
 def onTryCreateAnAccount(self, nickname):
     if len(nickname) < _ACCOUNT_NAME_MIN_LENGTH_REG:
         self.onNicknameTooSmall()
         return
     if not isAccountNameValid(nickname):
         self.onAccountNameIsInvalid()
         return
     host = g_preDefinedHosts.byUrl(self.__loginDataLoader.host)
     password = pwd_token.generate(self.__pass)
     urls = host.urlIterator
     if urls is not None:
         if urls.end():
             urls.cursor = 0
         host = urls.next()
         LOG_DEBUG('Gets next LoginApp url:', host)
     LOG_DEBUG('Try create an account: url=%s; login=%s; password=%s; nickName=%s' % (host.url,
      self.__loginDataLoader.user,
      password,
      nickname))
     connectionManager.connect(host.url, self.__loginDataLoader.user, password, host.keyPath, nickName=nickname, token2='', isNeedSavingPwd=False)
コード例 #8
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)
コード例 #9
0
def _connect():
    connectionManager.connect(_server, _login, _password, isNeedSavingPwd=True)
コード例 #10
0
def _connect():
    connectionManager.connect(_server, _login, _password, isNeedSavingPwd=True)
コード例 #11
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
コード例 #12
0
ファイル: __init__.py プロジェクト: kblw/wot_client
 def __connectToHost(self, host):
     connectionManager.connect(host.urlToken, '', '', host.keyPath, isNeedSavingPwd=self.__rememberMe, tokenLoginParams=self.__tokenLoginParams)
コード例 #13
0
ファイル: __init__.py プロジェクト: webiumsk/WoT
 def __doConnect(self):
     login, token2 = self.__credentials
     self.__addHandlers()
     connectionManager.connect(getHostURL(self.__host, token2), login, '', self.__host.keyPath, token2=token2)