mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 07:28:39 +00:00
Upgrade old auth file, save it and reload it.
This commit is contained in:
parent
f1730dc4d4
commit
89d04a393b
1 changed files with 7 additions and 0 deletions
|
@ -221,6 +221,7 @@ class AuthManager(component.Component):
|
||||||
)
|
)
|
||||||
|
|
||||||
def __load_auth_file(self):
|
def __load_auth_file(self):
|
||||||
|
save_and_reload = False
|
||||||
auth_file = configmanager.get_config_dir("auth")
|
auth_file = configmanager.get_config_dir("auth")
|
||||||
# Check for auth file and create if necessary
|
# Check for auth file and create if necessary
|
||||||
if not os.path.exists(auth_file):
|
if not os.path.exists(auth_file):
|
||||||
|
@ -254,6 +255,8 @@ class AuthManager(component.Component):
|
||||||
"using AUTH_LEVEL_DEFAULT(%s)..", username,
|
"using AUTH_LEVEL_DEFAULT(%s)..", username,
|
||||||
AUTH_LEVEL_DEFAULT)
|
AUTH_LEVEL_DEFAULT)
|
||||||
authlevel = AUTH_LEVEL_DEFAULT
|
authlevel = AUTH_LEVEL_DEFAULT
|
||||||
|
# This is probably an old auth file
|
||||||
|
save_and_reload = True
|
||||||
elif len(lsplit) == 3:
|
elif len(lsplit) == 3:
|
||||||
username, password, authlevel = lsplit
|
username, password, authlevel = lsplit
|
||||||
else:
|
else:
|
||||||
|
@ -279,6 +282,10 @@ class AuthManager(component.Component):
|
||||||
self.__create_localclient_account()
|
self.__create_localclient_account()
|
||||||
self.write_auth_file()
|
self.write_auth_file()
|
||||||
|
|
||||||
|
if save_and_reload:
|
||||||
|
log.info("Re-writing auth file (upgrade)")
|
||||||
|
self.write_auth_file()
|
||||||
|
|
||||||
|
|
||||||
def __create_auth_file(self):
|
def __create_auth_file(self):
|
||||||
auth_file = configmanager.get_config_dir("auth")
|
auth_file = configmanager.get_config_dir("auth")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue