Bugfix change password on commandline

This commit is contained in:
Ozzie Isaacs 2023-02-15 20:17:10 +01:00
parent 8ee34bf428
commit 7ca07f06ce
2 changed files with 6 additions and 3 deletions

View File

@ -112,16 +112,18 @@ def create_app():
cli_param.init()
ub.init_db(cli_param.settings_path, cli_param.user_credentials)
ub.init_db(cli_param.settings_path)
# pylint: disable=no-member
encrypt_key, error = config_sql.get_encryption_key(os.path.dirname(cli_param.settings_path))
config_sql.load_configuration(ub.session, encrypt_key)
config.init_config(ub.session, encrypt_key, cli_param)
if error:
log.error(error)
ub.password_change(cli_param.user_credentials)
if not limiter:
log.info('*** "flask-limiter" is needed for calibre-web to run. '
'Please install it using pip: "pip install flask-limiter" ***')

View File

@ -818,7 +818,7 @@ def init_db_thread():
return Session()
def init_db(app_db_path, user_credentials=None):
def init_db(app_db_path):
# Open session for database connection
global session
global app_DB_path
@ -839,6 +839,7 @@ def init_db(app_db_path, user_credentials=None):
create_admin_user(session)
create_anonymous_user(session)
def password_change(user_credentials=None):
if user_credentials:
username, password = user_credentials.split(':', 1)
user = session.query(User).filter(func.lower(User.name) == username.lower()).first()