示例#1
0
    def GoLogin(self, username, password):
        sm.GetService('overviewPresetSvc')
        sm.GetService('viewState').ActivateView('login')
        user = username
        pwd = util.PasswordString(password)
        sm.GetService('loading').ProgressWnd(
            localization.GetByLabel('UI/Login/LoggingIn'),
            localization.GetByLabel('UI/Login/ConnectingToCluster'), 1, 100)
        blue.pyos.synchro.Yield()
        eve.Message('OnConnecting')
        blue.pyos.synchro.Yield()
        eve.Message('OnConnecting2')
        blue.pyos.synchro.Yield()
        serverName = util.GetServerName()
        eve.serverName = serverName
        server = login.GetServerIP(serverName)
        loginparam = [user, pwd, server, 26000, 0]
        try:
            sm.GetService('connection').Login(loginparam)
        except:
            raise

        sm.GetService('device').PrepareMain()
        blue.pyos.synchro.Yield()
        blue.pyos.synchro.Yield()
        blue.pyos.synchro.Yield()
        blue.pyos.synchro.Yield()
        sm.GetService('viewState').ActivateView('charsel')
示例#2
0
 def Authorization(self):
     if self.header.has_key('Authorization'):
         try:
             uspa = self.header['Authorization']
             i = uspa.rfind(' ')
             uspa = uspa[i + 1:]
             import base64
             uspa = base64.decodestring(uspa)
             i = uspa.find(':')
             username = uspa[:i]
             password = uspa[i + 1:]
             return (username, util.PasswordString(password))
         except:
             pass
示例#3
0
文件: loginII.py 项目: R4M80MrX/eve-1
    def _Connect(self):
        if self.connecting:
            return
        self.connecting = True
        giveFocus = None
        try:
            if sm.GetService('gameui').UsingSingleSignOn():
                for arg in blue.pyos.GetArg()[1:]:
                    if arg.startswith('/ssoToken'):
                        try:
                            argName, token = arg.split('=')
                        except:
                            raise RuntimeError('Invalid format of SSO token, should be /ssoToken=<token>')

                sm.GetService('gameui').DoLogin(token)
                return
            user = self.usernameEditCtrl.GetValue()
            password = util.PasswordString(self.passwordEditCtrl.GetValue(raw=1))
            giveFocus = None
            if user is None or len(user) == 0:
                giveFocus = 'username'
            if password is None or len(password) == 0:
                giveFocus = 'password' if giveFocus is None else giveFocus
            if giveFocus is not None:
                eve.Message('LoginAuthFailed')
                self.CancelLogin()
                self.SetFocus(giveFocus)
                return
            log.LogInfo('server: %s selected' % self.serverIP)
            blue.pyos.synchro.Yield()
            if self.serverPort == sm.StartService('machoNet').defaultProxyPortOffset:
                if self.serverIP not in self.serverStatus:
                    self.UpdateServerStatus()
                try:
                    serverUserCount, serverversion, serverbuild, servercodename, updateinfo = self.serverStatus[self.serverIP]
                    if serverbuild > boot.build:
                        if self.serverIP == LIVE_SERVER:
                            if eve.Message('PatchLiveServerConnectWrongVersion', {'serverVersion': serverbuild,
                             'clientVersion': boot.build}, uiconst.YESNO) == uiconst.ID_YES:
                                self.UpdateServerStatus()
                        else:
                            eve.Message('PatchTestServerWarning', {'serverVersion': serverbuild,
                             'clientVersion': boot.build})
                        self.CancelLogin()
                        return
                except:
                    log.LogInfo('No serverStatus found for server %s' % self.serverIP)
                    sys.exc_clear()
                    eve.Message('UnableToConnectToServer')
                    self.CancelLogin()
                    return

            sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Login/LoggingIn'), localization.GetByLabel('UI/Login/ConnectingToCluster'), 1, 100)
            blue.pyos.synchro.Yield()
            eve.Message('OnConnecting')
            blue.pyos.synchro.Yield()
            eve.Message('OnConnecting2')
            blue.pyos.synchro.Yield()
            try:
                sm.GetService('connection').Login([user,
                 password,
                 self.serverIP,
                 self.serverPort,
                 0])
            except:
                self.CancelLogin()
                raise 

            settings.public.ui.Set('username', user or '-')
            prefs.newbie = 0
            knownUserNames = settings.public.ui.Get('usernames', [])[:]
            if user and user not in knownUserNames:
                knownUserNames.append(user)
                settings.public.ui.Set('usernames', knownUserNames)
        except UserError as e:
            if e.msg.startswith('LoginAuthFailed'):
                giveFocus = 'password'
            eve.Message(e.msg, e.dict)
            self.CancelLogin()
            self.SetFocus(giveFocus)
        finally:
            if not self.destroyed:
                self.connecting = 0