def initiateLogin(self, email, password, serverName, isSocialToken2Login, rememberUser): isToken2Login = isSocialToken2Login or self._preferences['token2'] if isToken2Login: authMethod = CONNECTION_METHOD.TOKEN2 else: authMethod = CONNECTION_METHOD.BASIC serverName = self._getHost(authMethod, serverName) self._preferences['session'] = BigWorld.wg_cpsalt( self._preferences['session']) self._preferences['password_length'] = len(password) self._preferences['remember_user'] = rememberUser self._preferences['login'] = email self._preferences['server_name'] = serverName loginParams = { 'login': self._preferences['login'], 'session': self._preferences['session'], 'temporary': str(int(not rememberUser)), 'auth_method': authMethod } if isToken2Login: loginParams['token2'] = self._preferences['token2'] if not isSocialToken2Login: self._preferences['login_type'] = 'credentials' connectionManager.initiateConnection(loginParams, password, serverName)
def initiateRelogin(self, login, token2, serverName): loginParams = {'login': login, 'token2': token2, 'session': BigWorld.wg_cpsalt(self._preferences['session']), 'temporary': str(int(not self._preferences['remember_user'])), 'auth_method': CONNECTION_METHOD.TOKEN2} self._preferences['server_name'] = serverName connectionManager.initiateConnection(loginParams, '', serverName)
def __onDataServerReceivedData(self, token, spaID, socialNetwork): Waiting.show('login') BigWorld.callback(0.1, BigWorld.wg_bringWindowToForeground) self.__loginParams['token'] = token self.__loginParams['account_id'] = spaID from Manager import SOCIAL_NETWORKS self.__preferences['login_type'] = socialNetwork or SOCIAL_NETWORKS.WGNI connectionManager.initiateConnection(self.__loginParams, '', self.__preferences['server_name'])
def __doConnect(self): login, token2 = self.__credentials self.__addHandlers() connectionManager.initiateConnection({'login': login, 'token2': token2, 'auth_method': CONNECTION_METHOD.TOKEN2, 'session': BigWorld.wg_cpsalt(g_loginManager.getPreference('session')), 'temporary': str(int(not g_loginManager.getPreference('remember_user')))}, '', getHostURL(self.__host, token2))
def callFromFlash(self, data): class Mobj: def __init__(self): pass BigWorld.wh_current = Mobj() BigWorld.wh_current.mode = 'add' if data.action == 'addAcc': loadWindow('AccountsManagerSubwindow') self.destroy() return elif data.action == 'edit': for account in BigWorld.wh_data.accounts: if str(account['id']) == str(data.id): BigWorld.wh_current.accId = account['id'] BigWorld.wh_current.mode = 'edit' BigWorld.wh_current.title = account['title'] BigWorld.wh_current.email = BigWorld.wg_ucpdata(account['email']) BigWorld.wh_current.password = BigWorld.wg_ucpdata(account['password']) BigWorld.wh_current.cluster = account['cluster'] loadWindow('AccountsManagerSubwindow') self.destroy() return elif data.action == 'delete': _buttons = RemoveConfirmDialogButtons() meta = SimpleDialogMeta(message='Подтвердите удаление аккаунта.', title='Удаление аккаунта.', buttons=_buttons) DialogsInterface.showDialog(meta, lambda result: onClickAction(result)) def onClickAction(result): if result: for q in xrange(len(BigWorld.wh_data.accounts)): if str(BigWorld.wh_data.accounts[q]['id']) == str(data.id): BigWorld.wh_data.accounts.pop(q) BigWorld.wh_data.write_accounts() BigWorld.wh_data.renew_accounts() self.destroy() loadWindow('AccountsManager') return elif data.action == 'submit': for account in BigWorld.wh_data.accounts: if str(account['id']) == str(data.id): params = { 'login' : BigWorld.wg_ucpdata(account['email']), 'auth_method': CONNECTION_METHOD.BASIC, 'session' : '0' } password = BigWorld.wg_ucpdata(account['password']) clusters = g_preDefinedHosts.shortList() account['cluster'] = int(account['cluster']) if len(clusters)-1<account['cluster']: account['cluster'] = 0 serverName = clusters[account['cluster']][0] connectionManager.initiateConnection(params, password, serverName) return
def initiateRelogin(self, login, token2, serverName): loginParams = { 'login': login, 'token2': token2, 'session': BigWorld.wg_cpsalt(self._preferences['session']), 'temporary': str(int(not self._preferences['remember_user'])), 'auth_method': CONNECTION_METHOD.TOKEN2 } self._preferences['server_name'] = serverName connectionManager.initiateConnection(loginParams, '', serverName)
def __onDataServerReceivedData(self, token, spaID, socialNetwork): Waiting.show('login') BigWorld.callback(0.1, BigWorld.wg_bringWindowToForeground) self.__loginParams['token'] = token self.__loginParams['account_id'] = spaID from Manager import SOCIAL_NETWORKS self.__preferences[ 'login_type'] = socialNetwork or SOCIAL_NETWORKS.WGNI connectionManager.initiateConnection(self.__loginParams, '', self.__preferences['server_name'])
def callFromFlash(self, data): class Mobj: def __init__(self): pass BigWorld.wh_current = Mobj() BigWorld.wh_current.mode = 'add' BigWorld.wh_current.submitLabel = 'Добавить' BigWorld.wh_current.cancelLabel = 'Отменить' if data.action == 'addAcc': loadWindow('AccountsManagerSubwindow') return if data.action == 'edit' and BigWorld.isKeyDown(Keys.KEY_LCONTROL): for q in BigWorld.wh_data.accounts: account = q if account['id'] == data.id: BigWorld.wh_current.accId = account['id'] BigWorld.wh_current.mode = 'edit' BigWorld.wh_current.submitLabel = 'Сохранить' BigWorld.wh_current.cancelLabel = 'Удалить' BigWorld.wh_current.title = account['title'] BigWorld.wh_current.email = account['email'] BigWorld.wh_current.password = BigWorld.wg_ucpdata(account['password']) BigWorld.wh_current.cluster = account['cluster'] loadWindow('AccountsManagerSubwindow') return if data.action == 'edit' and BigWorld.isKeyDown(Keys.KEY_LALT): for q in xrange(len(BigWorld.wh_data.accounts)): if BigWorld.wh_data.accounts[q]['id'] == data.id: BigWorld.wh_data.accounts.pop(q) BigWorld.wh_data.write_accounts() BigWorld.wh_data.renew_accounts() self.destroy() loadWindow('AccountsManager') return if data.action == 'login' or data.action == 'edit': for q in BigWorld.wh_data.accounts: account = q if account['id'] == data.id: params = { 'login' : account['email'], 'auth_method': CONNECTION_METHOD.BASIC, 'session' : '0' } password = BigWorld.wg_ucpdata(account['password']) serverName = g_preDefinedHosts.shortList()[int(account['cluster']) + 1][0] connectionManager.initiateConnection(params, password, serverName) return
def initiateLogin(self, email, password, serverName, isSocialToken2Login, rememberUser): authMethod = CONNECTION_METHOD.BASIC self._preferences['session'] = BigWorld.wg_cpsalt(self._preferences['session']) self._preferences['password_length'] = len(password) self._preferences['remember_user'] = rememberUser self._preferences['login'] = email self._preferences['server_name'] = serverName loginParams = {'login': self._preferences['login'], 'session': self._preferences['session'], 'temporary': str(int(not rememberUser)), 'auth_method': authMethod} if isSocialToken2Login or self._preferences['token2']: loginParams['auth_method'] = CONNECTION_METHOD.TOKEN2 loginParams['token2'] = self._preferences['token2'] if isSocialToken2Login: self._preferences['login_type'] = self._preferences['login_type'] else: self._preferences['login_type'] = 'credentials' connectionManager.initiateConnection(loginParams, password, serverName)
def __onDataServerReceivedData(self, token, spaID): Waiting.show('login') BigWorld.callback(0.1, BigWorld.wg_bringWindowToForeground) self.__loginParams['token'] = token self.__loginParams['account_id'] = spaID connectionManager.initiateConnection(self.__loginParams, '', self.__preferences['server_name'])