Update dashboard.py

Fixed the issue where TOTP Key is not actually reset when reset.
This commit is contained in:
Donald Zou 2025-05-03 16:13:30 +08:00
parent bf33a70727
commit f2d4ff6dc4

View File

@ -2957,7 +2957,7 @@ def API_isTotpEnabled():
@app.get(f'{APP_PREFIX}/api/Welcome_GetTotpLink') @app.get(f'{APP_PREFIX}/api/Welcome_GetTotpLink')
def API_Welcome_GetTotpLink(): def API_Welcome_GetTotpLink():
if not DashboardConfig.GetConfig("Account", "totp_verified")[1]: if not DashboardConfig.GetConfig("Account", "totp_verified")[1]:
DashboardConfig.SetConfig("Account", "totp_key", pyotp.random_base32()) DashboardConfig.SetConfig("Account", "totp_key", pyotp.random_base32(), True)
return ResponseObject( return ResponseObject(
data=pyotp.totp.TOTP(DashboardConfig.GetConfig("Account", "totp_key")[1]).provisioning_uri( data=pyotp.totp.TOTP(DashboardConfig.GetConfig("Account", "totp_key")[1]).provisioning_uri(
issuer_name="WGDashboard")) issuer_name="WGDashboard"))