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
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 onDoAutoLogin(self): lastLoginType = 'basic' if GUI_SETTINGS.socialNetworkLogin['enabled']: lastLoginType = self.__lastLoginType if lastLoginType != 'basic': self.__socialNetworkLogin.makeToken2LoginParams(self.__tokenLoginParams) if AUTO_LOGIN_QUERY_URL == self.__loginHost: g_preDefinedHosts.autoLoginQuery(self.__connectToHost) else: self.__connectToHost(g_preDefinedHosts.byUrl(self.__loginHost)) else: LOG_DEBUG('onDoAutoLogin') self.as_doAutoLoginS()
def onDoAutoLogin(self): lastLoginType = 'basic' if GUI_SETTINGS.socialNetworkLogin['enabled']: lastLoginType = self.__lastLoginType if lastLoginType != 'basic': self.__socialNetworkLogin.makeToken2LoginParams( self.__tokenLoginParams) if AUTO_LOGIN_QUERY_URL == self.__loginHost: g_preDefinedHosts.autoLoginQuery(self.__connectToHost) else: self.__connectToHost(g_preDefinedHosts.byUrl(self.__loginHost)) else: LOG_DEBUG('onDoAutoLogin') self.as_doAutoLoginS()
def __onServerReceivedData(self, token, spaID, tokenDecrypter): if self.__processingLoginBySocial: return None self.__processingLoginBySocial = True self.__tokenLoginParams = self.__socialNetworkLogin.getLoginParams() self.__tokenLoginParams['token'] = tokenDecrypter(token) self.__tokenLoginParams['account_id'] = spaID connectionManager.onConnected += self.__onSocialLoginConnected connectionManager.onRejected += self.__onSocialLoginRejected connectionManager.onDisconnected += self.__onSocialLoginDisconnected Waiting.show('login') if AUTO_LOGIN_QUERY_URL == self.__loginHost: g_preDefinedHosts.autoLoginQuery(self.__connectToHost) else: self.__connectToHost(g_preDefinedHosts.byUrl(self.__loginHost)) BigWorld.wg_bringWindowToForeground()
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)
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 initiateConnection(self, params, password, serverName): self.__setConnectionData(params, password) if serverName == AUTO_LOGIN_QUERY_URL: g_preDefinedHosts.autoLoginQuery(self.__setHostDataAndConnect) else: self.__setHostDataAndConnect(g_preDefinedHosts.byUrl(serverName))
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