Added user email modification to admin page

Pressing the user settings button brings up a list of all jellyfin
users, and allows you to add or change their stored email addresses.
Additionally, changed emails.json to use user ID instead of username.
The program automatically converts the file to the new format at start.
This commit is contained in:
2020-04-20 20:37:39 +01:00
parent e8ad3f98d6
commit 200ad24f96
6 changed files with 230 additions and 26 deletions

View File

@@ -3,6 +3,7 @@ import json
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from jellyfin_accounts.email import Mailgun, Smtp
from jellyfin_accounts.web_api import jf
from __main__ import config
from __main__ import email_log as log
@@ -41,7 +42,8 @@ class Handler(FileSystemEventHandler):
try:
with open(config['files']['emails'], 'r') as f:
emails = json.load(f)
address = emails[reset['UserName']]
id = jf.getUsers(reset['UserName'], public=False)['Id']
address = emails[id]
method = config['email']['method']
if method == 'mailgun':
email = Mailgun(address)