1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-05 07:20:14 +01:00

Fixed redirect functionality

This commit is contained in:
Donald Cheng Hong Zou 2022-03-22 16:17:12 -04:00
parent 191ff1abec
commit cefa80f317
2 changed files with 9 additions and 2 deletions

View File

@ -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']:

View File

@ -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("/");
}