mirror of
https://github.com/iFargle/headscale-webui.git
synced 2026-03-20 08:15:28 +01:00
test
This commit is contained in:
15
server.py
15
server.py
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user