Removed prints
Enabled additional reverse proxy authentication for opds feeds (fixes #2399)
This commit is contained in:
parent
f8fbc807f1
commit
ac13f6042a
|
@ -46,6 +46,7 @@ class MyLoginManager(LoginManager):
|
|||
if user is not None:
|
||||
app = current_app._get_current_object()
|
||||
user_loaded_from_cookie.send(app, user=user)
|
||||
# if session was restored from remember me cookie make login valid
|
||||
confirm_login()
|
||||
return user
|
||||
return None
|
||||
|
|
|
@ -101,13 +101,8 @@ def admin_required(f):
|
|||
|
||||
@admi.before_app_request
|
||||
def before_request():
|
||||
# make remember me function work
|
||||
#if current_user.is_authenticated:
|
||||
# print("before request confirm request {}".format(request.path))
|
||||
# confirm_login()
|
||||
#if not ub.check_user_session(current_user.id, flask_session.get('_id')) and 'opds' not in request.path:
|
||||
# log.info("before logout {}".format(request.path))
|
||||
# logout_user()
|
||||
if not ub.check_user_session(current_user.id, flask_session.get('_id')) and 'opds' not in request.path:
|
||||
logout_user()
|
||||
g.constants = constants
|
||||
# g.user = current_user
|
||||
g.google_site_verification = os.getenv('GOOGLE_SITE_VERIFICATION','')
|
||||
|
|
|
@ -89,7 +89,6 @@ def get_object_details(user=None,query_filter=None):
|
|||
|
||||
|
||||
def bind():
|
||||
print("bind")
|
||||
return _ldap.bind()
|
||||
|
||||
|
||||
|
|
|
@ -40,9 +40,11 @@ def requires_basic_auth_if_no_ano(f):
|
|||
@wraps(f)
|
||||
def decorated(*args, **kwargs):
|
||||
auth = request.authorization
|
||||
print("opds_requires_basic_auth")
|
||||
if (not auth or auth.type != 'basic'):
|
||||
if not auth or auth.type != 'basic':
|
||||
if config.config_anonbrowse != 1:
|
||||
user = load_user_from_reverse_proxy_header(request)
|
||||
if user:
|
||||
return f(*args, **kwargs)
|
||||
return _authenticate()
|
||||
else:
|
||||
return f(*args, **kwargs)
|
||||
|
@ -86,14 +88,12 @@ def _fetch_user_by_name(username):
|
|||
|
||||
@lm.user_loader
|
||||
def load_user(user_id):
|
||||
print("load_user: {}".format(user_id))
|
||||
user = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
|
||||
return user
|
||||
|
||||
|
||||
@lm.request_loader
|
||||
def load_user_from_request(req):
|
||||
print("load_from_request")
|
||||
def load_user_from_reverse_proxy_header(req):
|
||||
if config.config_allow_reverse_proxy_header_login:
|
||||
rp_header_name = config.config_reverse_proxy_login_header_name
|
||||
if rp_header_name:
|
||||
|
|
Loading…
Reference in New Issue
Block a user