login: update stuff

This commit is contained in:
John Cote 2019-12-02 18:29:08 -05:00
parent e5a29cebdd
commit d06a50b47d
2 changed files with 15 additions and 5 deletions

View file

@ -26,6 +26,7 @@ class AstronLoginManager(DistributedObjectGlobal):
self.sendUpdate('requestLogin', [playToken]) self.sendUpdate('requestLogin', [playToken])
def loginResponse(self, responseBlob): def loginResponse(self, responseBlob):
self.notify.debug("loginResponse")
responseData = json.loads(responseBlob) responseData = json.loads(responseBlob)
now = time.time() now = time.time()
returnCode = responseData.get('returnCode') returnCode = responseData.get('returnCode')
@ -38,8 +39,12 @@ class AstronLoginManager(DistributedObjectGlobal):
createFriendsWithChat = responseData.get('createFriendsWithChat') createFriendsWithChat = responseData.get('createFriendsWithChat')
canChat = createFriendsWithChat == "YES" or createFriendsWithChat == "CODE" canChat = createFriendsWithChat == "YES" or createFriendsWithChat == "CODE"
self.cr.secretChatAllowed = canChat self.cr.secretChatAllowed = canChat
if base.logPrivateInfo:
self.notify.info("CREATE_FRIENDS_WITH_CHAT from game server login: %s %s" % (createFriendsWithChat, canChat))
chatCodeCreationRule = responseData.get('chatCodeCreationRule') chatCodeCreationRule = responseData.get('chatCodeCreationRule')
self.cr.chatChatCodeCreationRule = chatCodeCreationRule self.cr.chatChatCodeCreationRule = chatCodeCreationRule
if base.logPrivateInfo:
self.notify.info("Chat code creation rule = %s" % chatCodeCreationRule)
self.cr.secretChatNeedsParentPassword = chatCodeCreationRule == "PARENT" self.cr.secretChatNeedsParentPassword = chatCodeCreationRule == "PARENT"
serverTime = responseData.get('serverTime') serverTime = responseData.get('serverTime')
self.cr.serverTimeUponLogin = serverTime self.cr.serverTimeUponLogin = serverTime
@ -56,6 +61,8 @@ class AstronLoginManager(DistributedObjectGlobal):
self.cr.setIsPaid(isPaid) self.cr.setIsPaid(isPaid)
if isPaid: if isPaid:
launcher.setPaidUserLoggedIn() launcher.setPaidUserLoggedIn()
if base.logPrivateInfo:
self.notify.info("Paid from game server login: %s" % isPaid)
WhiteListResponse = responseData.get('WhiteListResponse') WhiteListResponse = responseData.get('WhiteListResponse')
if WhiteListResponse == "YES": if WhiteListResponse == "YES":
self.cr.whiteListChatEnabled = 1 self.cr.whiteListChatEnabled = 1
@ -77,6 +84,8 @@ class AstronLoginManager(DistributedObjectGlobal):
self.cr.withParentAccount = False self.cr.withParentAccount = False
else: else:
self.notify.error("unknown toon account type %s" % toonAccountType) self.notify.error("unknown toon account type %s" % toonAccountType)
if base.logPrivateInfo:
self.notify.info("toonAccountType=%s" % toonAccountType)
self.userName = responseData.get('userName') self.userName = responseData.get('userName')
self.cr.userName = self.userName self.cr.userName = self.userName
self.notify.info("Login response return code %s" % returnCode) self.notify.info("Login response return code %s" % returnCode)
@ -84,7 +93,7 @@ class AstronLoginManager(DistributedObjectGlobal):
self.__handleLoginSuccess() self.__handleLoginSuccess()
elif returnCode == -13: elif returnCode == -13:
self.notify.info("Period Time Expired") self.notify.info("Period Time Expired")
messenger.send(self.doneEvent, [{'mode': 'reject'}]) self.cr.loginScreen.request("showLoginFailDialog", [OTPLocalizer.LoginScreenPeriodTimeExpired])
else: else:
self.notify.info("Login failed: %s" % errorString) self.notify.info("Login failed: %s" % errorString)
messenger.send(self.doneEvent, [{'mode': 'reject'}]) messenger.send(self.doneEvent, [{'mode': 'reject'}])
@ -94,9 +103,9 @@ class AstronLoginManager(DistributedObjectGlobal):
launcher.setGoUserName(self.userName) launcher.setGoUserName(self.userName)
launcher.setLastLogin(self.userName) launcher.setLastLogin(self.userName)
launcher.setUserLoggedIn() launcher.setUserLoggedIn()
if self.cr.loginInterface.freeTimeExpires == -1: if self.cr.loginScreen.loginInterface.freeTimeExpires == -1:
launcher.setPaidUserLoggedIn() launcher.setPaidUserLoggedIn()
if self.cr.loginInterface.needToSetParentPassword(): if self.cr.loginScreen.loginInterface.needToSetParentPassword():
messenger.send(self.doneEvent, [{'mode': 'getChatPassword'}]) messenger.send(self.doneEvent, [{'mode': 'getChatPassword'}])
else: else:
messenger.send(self.doneEvent, [{'mode': 'success'}]) messenger.send(self.doneEvent, [{'mode': 'success'}])
@ -106,7 +115,7 @@ class AstronLoginManager(DistributedObjectGlobal):
if len(errorString) < len(prefix): if len(errorString) < len(prefix):
return errorString return errorString
if errorString[:len(prefix)] == prefix: if errorString[:len(prefix)] == prefix:
return '%s%s' % (errorString, ', address=%s' % self.cr.getServerAddress()) return '%s%s' % (errorString, ', address=%s' % base.cr.getServerAddress())
return errorString return errorString
def parseAccountDays(self, accountDays): def parseAccountDays(self, accountDays):

View file

@ -160,7 +160,8 @@ class TeaserPanel(DirectObject):
class FeatureBrowser(DirectScrolledList): class FeatureBrowser(DirectScrolledList):
def __init__(self, parent = aspect2dp, **kw): def __init__(self, parent = aspect2dp, **kw):
optiondefs = (('parent', parent, None), self._parent = parent
optiondefs = (('parent', self._parent, None),
('relief', None, None), ('relief', None, None),
('numItemsVisible', 1, None), ('numItemsVisible', 1, None),
('items', [], None)) ('items', [], None))