mirror of
https://github.com/donaldzou/WGDashboard
synced 2025-02-26 05:58:47 +00:00
Updated dashboard.py
and DashboardConfigurationStore.js
- Added `session.clear()` to clean the session specific to each login session - Clear all cookie with the `signout` request and also clear again (just in case) in the frontend code.
This commit is contained in:
parent
fa04ad1395
commit
5462326f79
@ -1726,7 +1726,6 @@ def API_ValidateAuthentication():
|
|||||||
def API_AuthenticateLogin():
|
def API_AuthenticateLogin():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
if DashboardConfig.APIAccessed:
|
if DashboardConfig.APIAccessed:
|
||||||
|
|
||||||
authToken = hashlib.sha256(f"{request.headers.get('wg-dashboard-apikey')}{datetime.now()}".encode()).hexdigest()
|
authToken = hashlib.sha256(f"{request.headers.get('wg-dashboard-apikey')}{datetime.now()}".encode()).hexdigest()
|
||||||
session['username'] = authToken
|
session['username'] = authToken
|
||||||
resp = ResponseObject(True, DashboardConfig.GetConfig("Other", "welcome_session")[1])
|
resp = ResponseObject(True, DashboardConfig.GetConfig("Other", "welcome_session")[1])
|
||||||
@ -1761,6 +1760,7 @@ def API_AuthenticateLogin():
|
|||||||
def API_SignOut():
|
def API_SignOut():
|
||||||
resp = ResponseObject(True, "")
|
resp = ResponseObject(True, "")
|
||||||
resp.delete_cookie("authToken")
|
resp.delete_cookie("authToken")
|
||||||
|
session.clear()
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
@app.route(f'{APP_PREFIX}/api/getWireguardConfigurations', methods=["GET"])
|
@app.route(f'{APP_PREFIX}/api/getWireguardConfigurations', methods=["GET"])
|
||||||
|
@ -63,8 +63,9 @@ export const DashboardConfigurationStore = defineStore('DashboardConfigurationSt
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
async signOut(){
|
async signOut(){
|
||||||
await fetchGet("/api/signout", {}, (res) => {
|
await fetchGet("/api/signout", {}, () => {
|
||||||
this.removeActiveCrossServer();
|
this.removeActiveCrossServer();
|
||||||
|
document.cookie = '';
|
||||||
this.$router.go('/signin')
|
this.$router.go('/signin')
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user