mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Catch bad passwords on addon startup
This commit is contained in:
parent
22b5d413fd
commit
de95d23e5a
3 changed files with 13 additions and 3 deletions
|
@ -119,6 +119,10 @@ class Connect(object):
|
||||||
if 'ExchangeToken' not in state['Servers'][0]:
|
if 'ExchangeToken' not in state['Servers'][0]:
|
||||||
self.login()
|
self.login()
|
||||||
|
|
||||||
|
elif state['State'] == CONNECTION_STATE['Unavailable'] and state['Status_Code'] == 401:
|
||||||
|
# If the saved credentials don't work, restart the addon to force the password dialog to open
|
||||||
|
window('jellyfin.restart', clear=True)
|
||||||
|
|
||||||
elif state['State'] == CONNECTION_STATE['Unavailable']:
|
elif state['State'] == CONNECTION_STATE['Unavailable']:
|
||||||
raise HTTPException('ServerUnreachable', {})
|
raise HTTPException('ServerUnreachable', {})
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,11 @@ class API(object):
|
||||||
headers.update(auth_token_header)
|
headers.update(auth_token_header)
|
||||||
|
|
||||||
response = self.send_request(server['address'], "system/info", headers=headers)
|
response = self.send_request(server['address'], "system/info", headers=headers)
|
||||||
return response.json() if response.status_code == 200 else {}
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
return response.json()
|
||||||
|
else:
|
||||||
|
return response.status_code
|
||||||
|
|
||||||
def get_public_info(self, server_address):
|
def get_public_info(self, server_address):
|
||||||
response = self.send_request(server_address, "system/info/public")
|
response = self.send_request(server_address, "system/info/public")
|
||||||
|
|
|
@ -309,7 +309,7 @@ class ConnectionManager(object):
|
||||||
|
|
||||||
elif verify_authentication and server.get('AccessToken'):
|
elif verify_authentication and server.get('AccessToken'):
|
||||||
system_info = self.API.validate_authentication_token(server)
|
system_info = self.API.validate_authentication_token(server)
|
||||||
if system_info:
|
if system_info and type(system_info) == dict:
|
||||||
|
|
||||||
self._update_server_info(server, system_info)
|
self._update_server_info(server, system_info)
|
||||||
self.config.data['auth.user_id'] = server['UserId']
|
self.config.data['auth.user_id'] = server['UserId']
|
||||||
|
@ -319,7 +319,9 @@ class ConnectionManager(object):
|
||||||
|
|
||||||
server['UserId'] = None
|
server['UserId'] = None
|
||||||
server['AccessToken'] = None
|
server['AccessToken'] = None
|
||||||
return {'State': CONNECTION_STATE['Unavailable']}
|
return {
|
||||||
|
'State': CONNECTION_STATE['Unavailable'],
|
||||||
|
'Status_Code': system_info}
|
||||||
|
|
||||||
self._update_server_info(server, system_info)
|
self._update_server_info(server, system_info)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue