This commit is contained in:
iFargle
2023-02-20 22:48:28 +09:00
parent b58cd253d8
commit c7cbd005b0

View File

@@ -76,23 +76,12 @@ if AUTH_TYPE == "oidc":
from flask_oidc import OpenIDConnect
oidc = OpenIDConnect(app)
@app.route('/login')
@oidc.require_login
def login_page():
LOG.error("Logging in the user... ")
# Some basic sanity checks:
pass_checks = str(helper.load_checks())
LOG.error("Running sanity checks")
if pass_checks != "Pass":
return redirect(url_for(pass_checks))
LOG.error("Checks passed. redirecting..")
return redirect(url_for('overview'))
# Check if OIDC user is logged in before routing to any page:
@oidc.require_login
@app.before_request
@oidc.require_login
def check_oidc_credentials():
LOG.error("Checking if the user is logged in...: "+str(oidc.user_loggedin))
LOG.error("oidc.user_getfield('email'): "+oidc.user_getfield('email'))
if not oidc.user_loggedin:
LOG.error("User is not logged in. Redirecting to login")