mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2026-05-13 14:56:18 +00:00
Compare commits
12 Commits
#1257-fix
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa8bfe179a | ||
|
|
71077880ad | ||
|
|
d51889a222 | ||
|
|
4d20d00631 | ||
|
|
6ec8d2f201 | ||
|
|
91de807557 | ||
|
|
fedf7db8a4 | ||
|
|
cdd85b659c | ||
|
|
42f9460369 | ||
|
|
ba11a7a355 | ||
|
|
71f4449741 | ||
|
|
081c63cd43 |
@@ -335,7 +335,10 @@ def API_AuthenticateLogin():
|
|||||||
totpEnabled = DashboardConfig.GetConfig("Account", "enable_totp")[1]
|
totpEnabled = DashboardConfig.GetConfig("Account", "enable_totp")[1]
|
||||||
totpValid = False
|
totpValid = False
|
||||||
if totpEnabled:
|
if totpEnabled:
|
||||||
totpValid = pyotp.TOTP(DashboardConfig.GetConfig("Account", "totp_key")[1]).now() == data['totp']
|
totp_code = str(data.get("totp", "")).strip()
|
||||||
|
totpValid = pyotp.TOTP(
|
||||||
|
DashboardConfig.GetConfig("Account", "totp_key")[1]
|
||||||
|
).verify(totp_code, valid_window=1)
|
||||||
|
|
||||||
if (valid
|
if (valid
|
||||||
and data['username'] == DashboardConfig.GetConfig("Account", "username")[1]
|
and data['username'] == DashboardConfig.GetConfig("Account", "username")[1]
|
||||||
@@ -1455,11 +1458,15 @@ def API_Welcome_GetTotpLink():
|
|||||||
@app.post(f'{APP_PREFIX}/api/Welcome_VerifyTotpLink')
|
@app.post(f'{APP_PREFIX}/api/Welcome_VerifyTotpLink')
|
||||||
def API_Welcome_VerifyTotpLink():
|
def API_Welcome_VerifyTotpLink():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
totp = pyotp.TOTP(DashboardConfig.GetConfig("Account", "totp_key")[1]).now()
|
totp_code = str(data.get("totp", "")).strip()
|
||||||
if totp == data['totp']:
|
totpValid = pyotp.TOTP(
|
||||||
|
DashboardConfig.GetConfig("Account", "totp_key")[1]
|
||||||
|
).verify(totp_code, valid_window=1)
|
||||||
|
|
||||||
|
if totpValid:
|
||||||
DashboardConfig.SetConfig("Account", "totp_verified", "true")
|
DashboardConfig.SetConfig("Account", "totp_verified", "true")
|
||||||
DashboardConfig.SetConfig("Account", "enable_totp", "true")
|
DashboardConfig.SetConfig("Account", "enable_totp", "true")
|
||||||
return ResponseObject(totp == data['totp'])
|
return ResponseObject(totpValid)
|
||||||
|
|
||||||
@app.post(f'{APP_PREFIX}/api/Welcome_Finish')
|
@app.post(f'{APP_PREFIX}/api/Welcome_Finish')
|
||||||
def API_Welcome_Finish():
|
def API_Welcome_Finish():
|
||||||
@@ -1551,7 +1558,8 @@ def API_Email_Send():
|
|||||||
subject = Template(data.get('Subject', '')).render(peer=p.toJson(), configurationFile=download)
|
subject = Template(data.get('Subject', '')).render(peer=p.toJson(), configurationFile=download)
|
||||||
if data.get('IncludeAttachment', False):
|
if data.get('IncludeAttachment', False):
|
||||||
u = str(uuid4())
|
u = str(uuid4())
|
||||||
attachmentName = f'{u}.conf'
|
peerName = p.toJson().get('name', '').strip()
|
||||||
|
attachmentName = f'{peerName if peerName else u}.conf'
|
||||||
with open(os.path.join('./attachments', attachmentName,), 'w+') as f:
|
with open(os.path.join('./attachments', attachmentName,), 'w+') as f:
|
||||||
f.write(download['file'])
|
f.write(download['file'])
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ psycopg[binary]==3.3.3
|
|||||||
PyMySQL==1.1.2
|
PyMySQL==1.1.2
|
||||||
tzlocal==5.3.1
|
tzlocal==5.3.1
|
||||||
python-jose==3.5.0
|
python-jose==3.5.0
|
||||||
pydantic==2.13.3
|
pydantic==2.13.4
|
||||||
|
|||||||
Reference in New Issue
Block a user