This commit is contained in:
Donald Zou 2025-05-27 16:46:44 +08:00
parent 8a77fbfefd
commit 93a23671e4
2 changed files with 2 additions and 4 deletions

View File

@ -150,6 +150,7 @@ def API_AuthenticateLogin():
if DashboardConfig.APIAccessed:
authToken = hashlib.sha256(f"{request.headers.get('wg-dashboard-apikey')}{datetime.now()}".encode()).hexdigest()
session['role'] = 'admin'
session['username'] = authToken
resp = ResponseObject(True, DashboardConfig.GetConfig("Other", "welcome_session")[1])
resp.set_cookie("authToken", authToken)
@ -167,6 +168,7 @@ def API_AuthenticateLogin():
and ((totpEnabled and totpValid) or not totpEnabled)
):
authToken = hashlib.sha256(f"{data['username']}{datetime.now()}".encode()).hexdigest()
session['role'] = 'admin'
session['username'] = authToken
resp = ResponseObject(True, DashboardConfig.GetConfig("Other", "welcome_session")[1])
resp.set_cookie("authToken", authToken)
@ -1190,14 +1192,11 @@ def peerInformationBackgroundThread():
with app.app_context():
for c in WireguardConfigurations.values():
if c.getStatus():
# try:
c.getPeersTransfer()
c.getPeersLatestHandshake()
c.getPeersEndpoint()
c.getPeersList()
c.getRestrictedPeersList()
# except Exception as e:
# print(f"[WGDashboard] Background Thread #1 Error: {str(e)}", flush=True)
time.sleep(10)
def peerJobScheduleBackgroundThread():

View File

@ -160,7 +160,6 @@ router.beforeEach(async (to, from, next) => {
}
dashboardConfigurationStore.Redirect = undefined;
next()
}else{
dashboardConfigurationStore.Redirect = to;
next("/signin")