diff --git a/src/dashboard.py b/src/dashboard.py index 2aecb02..16dfbd1 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -653,7 +653,10 @@ def auth_req(): else: session['message'] = "" conf.clear() - return redirect("/signin?redirect=" + str(request.url)) + redirectURL = str(request.url) + redirectURL = redirectURL.replace("http://", "") + redirectURL = redirectURL.replace("https://", "") + return redirect("/signin?redirect=" + redirectURL) else: if request.endpoint in ['signin', 'signout', 'auth', 'settings', 'update_acct', 'update_pwd', 'update_app_ip_port', 'update_wg_conf_path']: diff --git a/src/templates/signin.html b/src/templates/signin.html index 16e5e1b..0a49285 100644 --- a/src/templates/signin.html +++ b/src/templates/signin.html @@ -67,7 +67,11 @@ if (res.status === true){ const urlParams = new URLSearchParams(window.location.search); if (urlParams.get("redirect")){ - window.location.replace(urlParams.get("redirect")) + if (document.URL.substring(0, 5) == "http:"){ + window.location.replace(`http://${urlParams.get("redirect")}`) + }else if (document.URL.substring(0, 5) == "https"){ + window.location.replace(`https://${urlParams.get("redirect")}`) + } }else{ window.location.replace("/"); }