Skip to content

Commit

Permalink
Additional monkey patching
Browse files Browse the repository at this point in the history
  • Loading branch information
P-T-I committed Jul 26, 2022
1 parent 1647054 commit b17e1f8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6
2.7
2 changes: 1 addition & 1 deletion spectacles/webapp/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6
2.7
2 changes: 1 addition & 1 deletion spectacles/webapp/auth/openid_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ def oidc_logout():
)

oidc.logout()
except Exception:
except TypeError:
raise
26 changes: 15 additions & 11 deletions spectacles/webapp/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ def load_user(user_id):
def logout():
logout_user()

try:
from .openid_login import oidc_logout

oidc_logout()
except ImportError:
pass
except Exception:
pass

# Redirect to login page
return redirect(url_for("auth.func_login"))
if config.OPENID_LOGIN:
try:
from .openid_login import oidc_logout

oidc_logout()
except ImportError:
pass
except TypeError:
pass

if config.PORTAL_URL is not None:
return redirect(config.PORTAL_URL)
else:
# Redirect to login page
return redirect(url_for("auth.func_login"))


def verify_password(password, password_hash):
Expand Down
2 changes: 2 additions & 0 deletions spectacles/webapp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@ class Config(object):
SYSLOG_SERVER = os.getenv("SYSLOG_SERVER", "172.16.1.1")
SYSLOG_PORT = os.getenv("SYSLOG_PORT", "5140")

PORTAL_URL = os.getenv("PORTAL_URL", None)

REGISTER_ENABLED = getenv_bool("REGISTER_ENABLED", "False")
8 changes: 8 additions & 0 deletions wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

monkey.patch_all()

# additional monkey patch for allowing self-signed certificates
import ssl

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
ssl._create_default_https_context = ctx

import click
from flask.cli import with_appcontext
import logging
Expand Down

0 comments on commit b17e1f8

Please sign in to comment.