1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-21 23:01:39 +01:00

Fixed auth req = false not working

This commit is contained in:
Donald Zou 2024-09-21 00:08:37 +08:00
parent 6634c9170b
commit 40cad2637f
3 changed files with 4 additions and 4 deletions

View File

@ -1505,8 +1505,8 @@ def API_ValidateAPIKey():
@app.route(f'{APP_PREFIX}/api/validateAuthentication', methods=["GET"]) @app.route(f'{APP_PREFIX}/api/validateAuthentication', methods=["GET"])
def API_ValidateAuthentication(): def API_ValidateAuthentication():
if DashboardConfig.GetConfig("Server", "auth_req")[1]: if DashboardConfig.GetConfig("Server", "auth_req")[1]:
token = request.cookies.get("authToken") + "" token = request.cookies.get("authToken")
if (token == "" or "username" not in session or session["username"] != token): if (token is None or token == "" or "username" not in session or session["username"] != token):
return ResponseObject(False, "Invalid authentication.") return ResponseObject(False, "Invalid authentication.")
return ResponseObject(True) return ResponseObject(True)

File diff suppressed because one or more lines are too long

View File

@ -164,7 +164,7 @@ router.beforeEach(async (to, from, next) => {
} }
}else { }else {
await dashboardConfigurationStore.getConfiguration() await dashboardConfigurationStore.getConfiguration()
if (to.path === "/signin"){ if (to.path === "/signin" && auth){
next("/") next("/")
}else{ }else{
next() next()