Fix logging out also deleting Plex token

This commit is contained in:
croneter 2018-11-19 08:17:49 +01:00
parent a045063769
commit 3a514365ee
2 changed files with 22 additions and 1 deletions

View file

@ -61,6 +61,27 @@ class Account(object):
self.pms_token[:5] if self.pms_token else None) self.pms_token[:5] if self.pms_token else None)
LOG.debug('User is restricted Home user: %s', self.restricted_user) LOG.debug('User is restricted Home user: %s', self.restricted_user)
def log_out(self):
LOG.debug('Logging-out user')
self.plex_username = None
self.plex_user_id = None
self.pms_token = None
self.avatar = None
self.restricted_user = None
self.authenticated = False
self._session = None
utils.settings('username', value='')
utils.settings('userid', value='')
utils.settings('plex_restricteduser', value='')
utils.settings('accessToken', value='')
utils.settings('plexAvatar', value='')
utils.window('plex_restricteduser', clear=True)
utils.window('pms_token', clear=True)
utils.window('plexAvatar', clear=True)
utils.window('plex_authenticated', clear=True)
def clear(self): def clear(self):
LOG.debug('Clearing account settings') LOG.debug('Clearing account settings')
self.plex_username = None self.plex_username = None

View file

@ -175,7 +175,7 @@ class Service():
app.SYNC.suspend_library_thread = False app.SYNC.suspend_library_thread = False
return False return False
LOG.info('Successfully stopped library sync') LOG.info('Successfully stopped library sync')
app.ACCOUNT.clear() app.ACCOUNT.log_out()
LOG.info('User has been logged out') LOG.info('User has been logged out')
return True return True