Added ability to log in with jellyfin credentials

The new jellyfin_login and admin_only allow anyone use their username and
password from jellyfin to login to the admin page, and restrict this to jellyfin
admins only, respectively.
This commit is contained in:
2020-04-25 17:20:46 +01:00
parent 9b8204eb12
commit b9cefcc111
4 changed files with 93 additions and 16 deletions

View File

@@ -7,7 +7,6 @@ import secrets
import time
from __main__ import config, config_path, app, g
from __main__ import web_log as log
from jellyfin_accounts.login import auth
from jellyfin_accounts.validate_password import PasswordValidator
def resp(success=True, code=500):
@@ -51,6 +50,8 @@ jf = Jellyfin(config['jellyfin']['server'],
config['jellyfin']['device'],
config['jellyfin']['device_id'])
from jellyfin_accounts.login import auth
attempts = 0
success = False
while attempts != 3:
@@ -262,7 +263,6 @@ def deleteInvite():
@auth.login_required
def get_token():
token = g.user.generate_token()
log.debug('Token generated')
return jsonify({'token': token.decode('ascii')})