Misc clarification

This commit is contained in:
Alexandre Aubin 2023-04-11 18:58:24 +02:00
parent 8ce490a8e7
commit 653289c446

5
app.py
View file

@ -151,7 +151,7 @@ def delete_using_recovery_password_or_key(subdomain):
with open(f"{app.config['DB_FOLDER']}/{subdomain}.key") as f: with open(f"{app.config['DB_FOLDER']}/{subdomain}.key") as f:
if not hmac.compare_digest(key, f.read()): if not hmac.compare_digest(key, f.read()):
return '"Access denied"', 403 return '"Access denied"', 403
if recovery_password: elif recovery_password:
if not os.path.exists( if not os.path.exists(
f"{app.config['DB_FOLDER']}/{subdomain}.recovery_password" f"{app.config['DB_FOLDER']}/{subdomain}.recovery_password"
): ):
@ -161,6 +161,9 @@ def delete_using_recovery_password_or_key(subdomain):
if not bcrypt.checkpw(recovery_password.encode(), hashed): if not bcrypt.checkpw(recovery_password.encode(), hashed):
return '"Access denied"', 403 return '"Access denied"', 403
# Shouldnt happen, this is checked before
else:
return '"Access denied"', 403
if os.path.exists(f"{app.config['DB_FOLDER']}/{subdomain}.key"): if os.path.exists(f"{app.config['DB_FOLDER']}/{subdomain}.key"):
os.remove(f"{app.config['DB_FOLDER']}/{subdomain}.key") os.remove(f"{app.config['DB_FOLDER']}/{subdomain}.key")