From 3bed120a8e2a6482ee6c787bea488f1e624e862e Mon Sep 17 00:00:00 2001 From: Halali Date: Mon, 17 Sep 2018 14:18:52 +0200 Subject: [PATCH] Convert old auth settings to new --- init.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/init.py b/init.py index e0fa46d66..f9cb90e71 100644 --- a/init.py +++ b/init.py @@ -235,9 +235,16 @@ try: cfg.read_file(f) except Exception: pass -cfg.remove_option('auth', 'enabled') -with open(config_file, 'w+') as configfile: - cfg.write(configfile) +if cfg.has_section('auth'): + if cfg.has_option('auth', 'enabled'): + enabled = cfg.getboolean('auth', 'enabled') + if enabled is True: + cfg.set('auth', 'type', 'basic') + elif enabled is False: + cfg.set('auth', 'type', 'basic') + cfg.remove_option('auth', 'enabled') + with open(config_file, 'w+') as configfile: + cfg.write(configfile) from cork import Cork import time