mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Merge pull request #301 from mcarlton00/password-reset
Add reset password dialog to addon menu
This commit is contained in:
commit
f1eec7a90a
7 changed files with 28 additions and 5 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', {})
|
||||||
|
|
||||||
|
@ -253,8 +257,9 @@ class Connect(object):
|
||||||
client.set_credentials(get_credentials())
|
client.set_credentials(get_credentials())
|
||||||
manager = client.auth
|
manager = client.auth
|
||||||
|
|
||||||
|
username = settings('username')
|
||||||
try:
|
try:
|
||||||
self.login_manual(manager=manager)
|
self.login_manual(user=username, manager=manager)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,8 @@ class Events(object):
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.jellyfin)')
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.jellyfin)')
|
||||||
elif mode == 'adduser':
|
elif mode == 'adduser':
|
||||||
add_user()
|
add_user()
|
||||||
|
elif mode == 'updatepassword':
|
||||||
|
event('UpdatePassword')
|
||||||
elif mode == 'thememedia':
|
elif mode == 'thememedia':
|
||||||
get_themes()
|
get_themes()
|
||||||
elif mode == 'managelibs':
|
elif mode == 'managelibs':
|
||||||
|
@ -177,6 +179,7 @@ def listing():
|
||||||
directory(translate(33134), "plugin://plugin.video.jellyfin/?mode=addserver", False)
|
directory(translate(33134), "plugin://plugin.video.jellyfin/?mode=addserver", False)
|
||||||
directory(translate(33054), "plugin://plugin.video.jellyfin/?mode=adduser", False)
|
directory(translate(33054), "plugin://plugin.video.jellyfin/?mode=adduser", False)
|
||||||
directory(translate(5), "plugin://plugin.video.jellyfin/?mode=settings", False)
|
directory(translate(5), "plugin://plugin.video.jellyfin/?mode=settings", False)
|
||||||
|
directory(translate(33161), "plugin://plugin.video.jellyfin/?mode=updatepassword", False)
|
||||||
directory(translate(33058), "plugin://plugin.video.jellyfin/?mode=reset", False)
|
directory(translate(33058), "plugin://plugin.video.jellyfin/?mode=reset", False)
|
||||||
directory(translate(33180), "plugin://plugin.video.jellyfin/?mode=restartservice", False)
|
directory(translate(33180), "plugin://plugin.video.jellyfin/?mode=restartservice", False)
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ class Service(xbmc.Monitor):
|
||||||
'LibraryChanged', 'ServerOnline', 'SyncLibrary', 'RepairLibrary', 'RemoveLibrary',
|
'LibraryChanged', 'ServerOnline', 'SyncLibrary', 'RepairLibrary', 'RemoveLibrary',
|
||||||
'SyncLibrarySelection', 'RepairLibrarySelection', 'AddServer',
|
'SyncLibrarySelection', 'RepairLibrarySelection', 'AddServer',
|
||||||
'Unauthorized', 'UserConfigurationUpdated', 'ServerRestarting',
|
'Unauthorized', 'UserConfigurationUpdated', 'ServerRestarting',
|
||||||
'RemoveServer', 'AddLibrarySelection', 'RemoveLibrarySelection'):
|
'RemoveServer', 'UpdatePassword', 'AddLibrarySelection', 'RemoveLibrarySelection'):
|
||||||
return
|
return
|
||||||
|
|
||||||
data = json.loads(data)[0]
|
data = json.loads(data)[0]
|
||||||
|
@ -243,6 +243,8 @@ class Service(xbmc.Monitor):
|
||||||
self.connect.remove_server(data['Id'])
|
self.connect.remove_server(data['Id'])
|
||||||
xbmc.executebuiltin("Container.Refresh")
|
xbmc.executebuiltin("Container.Refresh")
|
||||||
|
|
||||||
|
elif method == 'UpdatePassword':
|
||||||
|
self.connect.setup_login_manual()
|
||||||
elif method == 'UserDataChanged' and self.library_thread:
|
elif method == 'UserDataChanged' and self.library_thread:
|
||||||
if data.get('ServerId') or not window('jellyfin_startup.bool'):
|
if data.get('ServerId') or not window('jellyfin_startup.bool'):
|
||||||
return
|
return
|
||||||
|
|
|
@ -431,7 +431,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 { 'Status_Code': 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 'Status_Code' not in system_info:
|
||||||
|
|
||||||
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,8 @@ class ConnectionManager(object):
|
||||||
|
|
||||||
server['UserId'] = None
|
server['UserId'] = None
|
||||||
server['AccessToken'] = None
|
server['AccessToken'] = None
|
||||||
return {'State': CONNECTION_STATE['Unavailable']}
|
system_info['State'] = CONNECTION_STATE['Unavailable']
|
||||||
|
return system_info
|
||||||
|
|
||||||
self._update_server_info(server, system_info)
|
self._update_server_info(server, system_info)
|
||||||
|
|
||||||
|
|
|
@ -801,6 +801,10 @@ msgctxt "#33160"
|
||||||
msgid "To avoid errors, please update Jellyfin for Kodi to version: "
|
msgid "To avoid errors, please update Jellyfin for Kodi to version: "
|
||||||
msgstr "To avoid errors, please update Jellyfin for Kodi to version: "
|
msgstr "To avoid errors, please update Jellyfin for Kodi to version: "
|
||||||
|
|
||||||
|
msgctxt "#33161"
|
||||||
|
msgid "Update password"
|
||||||
|
msgstr "Update password"
|
||||||
|
|
||||||
msgctxt "#33162"
|
msgctxt "#33162"
|
||||||
msgid "Reset the music library?"
|
msgid "Reset the music library?"
|
||||||
msgstr "Reset the music library?"
|
msgstr "Reset the music library?"
|
||||||
|
|
|
@ -801,6 +801,10 @@ msgctxt "#33160"
|
||||||
msgid "To avoid errors, please update Jellyfin for Kodi to version: "
|
msgid "To avoid errors, please update Jellyfin for Kodi to version: "
|
||||||
msgstr "To avoid errors, please update Jellyfin for Kodi to version: "
|
msgstr "To avoid errors, please update Jellyfin for Kodi to version: "
|
||||||
|
|
||||||
|
msgctxt "#33161"
|
||||||
|
msgid "Update password"
|
||||||
|
msgstr "Update password"
|
||||||
|
|
||||||
msgctxt "#33162"
|
msgctxt "#33162"
|
||||||
msgid "Reset the music library?"
|
msgid "Reset the music library?"
|
||||||
msgstr "Reset the music library?"
|
msgstr "Reset the music library?"
|
||||||
|
|
Loading…
Reference in a new issue