Fixes from testrun
This commit is contained in:
@@ -102,8 +102,9 @@ def create_app():
|
||||
|
||||
log.info('Starting Calibre Web...')
|
||||
if sys.version_info < (3, 0):
|
||||
log.info('Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2 please consider upgrading to Python3')
|
||||
print('Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2 please consider upgrading to Python3')
|
||||
log.info('*** Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2, please update your installation to Python3 ***')
|
||||
print('*** Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2, please update your installation to Python3 ***')
|
||||
sys.exit(5)
|
||||
Principal(app)
|
||||
lm.init_app(app)
|
||||
app.secret_key = os.getenv('SECRET_KEY', config_sql.get_flask_session_key(ub.session))
|
||||
|
||||
@@ -39,7 +39,9 @@ def _get_command_version(path, pattern, argument=None):
|
||||
if argument:
|
||||
command.append(argument)
|
||||
try:
|
||||
return process_wait(command, pattern=pattern).string
|
||||
match = process_wait(command, pattern=pattern)
|
||||
if isinstance(match, re.Match):
|
||||
return match.string
|
||||
except Exception as ex:
|
||||
log.warning("%s: %s", path, ex)
|
||||
return _EXECUTION_ERROR
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<input type="checkbox" id="config_use_google_drive" name="config_use_google_drive" data-control="gdrive_settings" {% if config.config_use_google_drive %}checked{% endif %} >
|
||||
<label for="config_use_google_drive">{{_('Use Google Drive?')}}</label>
|
||||
</div>
|
||||
{% if not gdriveError %}
|
||||
{% if not gdriveError and config.config_use_google_drive %}
|
||||
{% if show_authenticate_google_drive and config.config_use_google_drive %}
|
||||
<div class="form-group required">
|
||||
<a href="{{ url_for('gdrive.authenticate_google_drive') }}" id="gdrive_auth" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-sm-7">
|
||||
{% if log_enable %}
|
||||
<a class="btn btn-default" id="log_file" href="{{url_for('admin.download_log', logtype=0)}}">{{_('Download Calibre-Web Log')}}</a>
|
||||
<a class="btn btn-default" id="log_file_0" href="{{url_for('admin.download_log', logtype=0)}}">{{_('Download Calibre-Web Log')}}</a>
|
||||
{% endif %}
|
||||
{% if accesslog_enable %}
|
||||
<a class="btn btn-default" id="log_file" href="{{url_for('admin.download_log', logtype=1)}}">{{_('Download Access Log')}}</a>
|
||||
<a class="btn btn-default" id="log_file_1" href="{{url_for('admin.download_log', logtype=1)}}">{{_('Download Access Log')}}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1523,6 +1523,7 @@ def login():
|
||||
login_result, error = services.ldap.bind_user(form['username'], form['password'])
|
||||
if login_result:
|
||||
login_user(user, remember=bool(form.get('remember_me')))
|
||||
ub.store_user_session()
|
||||
log.debug(u"You are now logged in as: '%s'", user.name)
|
||||
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.name),
|
||||
category="success")
|
||||
@@ -1530,6 +1531,7 @@ def login():
|
||||
elif login_result is None and user and check_password_hash(str(user.password), form['password']) \
|
||||
and user.name != "Guest":
|
||||
login_user(user, remember=bool(form.get('remember_me')))
|
||||
ub.store_user_session()
|
||||
log.info("Local Fallback Login as: '%s'", user.name)
|
||||
flash(_(u"Fallback Login as: '%(nickname)s', LDAP Server not reachable, or user not known",
|
||||
nickname=user.name),
|
||||
@@ -1559,6 +1561,7 @@ def login():
|
||||
else:
|
||||
if user and check_password_hash(str(user.password), form['password']) and user.name != "Guest":
|
||||
login_user(user, remember=bool(form.get('remember_me')))
|
||||
ub.store_user_session()
|
||||
log.debug(u"You are now logged in as: '%s'", user.name)
|
||||
flash(_(u"You are now logged in as: '%(nickname)s'", nickname=user.name), category="success")
|
||||
config.config_is_initial = False
|
||||
@@ -1582,6 +1585,7 @@ def login():
|
||||
@login_required
|
||||
def logout():
|
||||
if current_user is not None and current_user.is_authenticated:
|
||||
ub.delete_user_session(current_user.id, flask_session.get('_id',""))
|
||||
logout_user()
|
||||
if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3):
|
||||
logout_oauth_user()
|
||||
|
||||
Reference in New Issue
Block a user