Always hash http password

This commit is contained in:
JonnyWong16 2021-06-15 21:09:37 -07:00
parent dff9a56950
commit b0a395ad0b
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
6 changed files with 21 additions and 78 deletions

View file

@ -3133,8 +3133,6 @@ class WebInterface(object):
"allow_guest_access": checked(plexpy.CONFIG.ALLOW_GUEST_ACCESS),
"history_table_activity": checked(plexpy.CONFIG.HISTORY_TABLE_ACTIVITY),
"http_basic_auth": checked(plexpy.CONFIG.HTTP_BASIC_AUTH),
"http_hash_password": checked(plexpy.CONFIG.HTTP_HASH_PASSWORD),
"http_hashed_password": plexpy.CONFIG.HTTP_HASHED_PASSWORD,
"http_host": plexpy.CONFIG.HTTP_HOST,
"http_username": plexpy.CONFIG.HTTP_USERNAME,
"http_port": plexpy.CONFIG.HTTP_PORT,
@ -3271,7 +3269,7 @@ class WebInterface(object):
"notify_group_recently_added_grandparent", "notify_group_recently_added_parent",
"notify_new_device_initial_only",
"notify_server_update_repeat", "notify_plexpy_update_repeat",
"monitor_pms_updates", "get_file_sizes", "log_blacklist", "http_hash_password",
"monitor_pms_updates", "get_file_sizes", "log_blacklist",
"allow_guest_access", "cache_images", "http_proxy", "http_basic_auth", "notify_concurrent_by_ip",
"history_table_activity", "plexpy_auto_update",
"themoviedb_lookup", "tvmaze_lookup", "musicbrainz_lookup", "http_plex_admin",
@ -3285,29 +3283,12 @@ class WebInterface(object):
kwargs[checked_config] = 1
# If http password exists in config, do not overwrite when blank value received
if kwargs.get('http_password'):
if kwargs['http_password'] == ' ' and plexpy.CONFIG.HTTP_PASSWORD != '':
if kwargs.get('http_hash_password') and not plexpy.CONFIG.HTTP_HASHED_PASSWORD:
kwargs['http_password'] = make_hash(plexpy.CONFIG.HTTP_PASSWORD)
kwargs['http_hashed_password'] = 1
else:
kwargs['http_password'] = plexpy.CONFIG.HTTP_PASSWORD
elif kwargs['http_password'] and kwargs.get('http_hash_password'):
kwargs['http_password'] = make_hash(kwargs['http_password'])
kwargs['http_hashed_password'] = 1
# Flag to refresh JWT uuid to log out clients
kwargs['jwt_update_secret'] = True and not first_run
elif not kwargs.get('http_hash_password'):
kwargs['http_hashed_password'] = 0
# Flag to refresh JWT uuid to log out clients
kwargs['jwt_update_secret'] = True and not first_run
if kwargs.get('http_password') != ' ':
kwargs['http_password'] = make_hash(kwargs['http_password'])
# Flag to refresh JWT uuid to log out clients
kwargs['jwt_update_secret'] = True and not first_run
else:
kwargs['http_hashed_password'] = 0
kwargs['http_password'] = plexpy.CONFIG.HTTP_PASSWORD
for plain_config, use_config in [(x[4:], x) for x in kwargs if x.startswith('use_')]:
# the use prefix is fairly nice in the html, but does not match the actual config