Commit 28282edb authored by echel0n's avatar echel0n
Browse files

Added support for multi-login based on user-defined allowed user list

parent fd577ef0
# Changelog
- * 14afaff - 2018-09-09: Release v9.3.75
- * 93af303 - 2018-09-09: Added support for multi-login based on user-defined allowed user list
- * 80a1cf8 - 2018-09-09: Release v9.3.75
- * b0e0ac6 - 2018-09-09: Added ability to optionally restore application id when restoring backup. Fixed issue with provider cache API calls.
- * 0a5590f - 2018-09-09: Release v9.3.74
- * fd54d1e - 2018-09-08: Pre-Release v9.3.74.dev1
......
......@@ -38,6 +38,9 @@ class API(object):
def userinfo(self):
return self._request('GET', 'userinfo')
def allowed_usernames(self, appid):
return self._request('GET', 'allowed-usernames/{}'.format(appid))
def register_appid(self, appid, username=""):
return self._request('POST', 'register-appid', json={'appid': appid})
......
......@@ -294,8 +294,8 @@ class LoginHandler(BaseHandler):
if userinfo.get('sub') == api_token_decoded['sub']:
API().register_appid(sickrage.app.config.app_id)
else:
app_ids = userinfo.get('appid', [])
if sickrage.app.config.app_id not in app_ids:
allowed_usernames = API().allowed_usernames(sickrage.app.config.app_id)['data']
if not userinfo['preferred_username'] in allowed_usernames:
return self.redirect('/logout')
except Exception as e:
return self.redirect('/logout')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment