Spaces:
Sleeping
Sleeping
deploy at 2024-08-25 15:53:37.574437
Browse files
main.py
CHANGED
|
@@ -64,7 +64,7 @@ from urllib.parse import quote
|
|
| 64 |
import uuid
|
| 65 |
import secrets
|
| 66 |
|
| 67 |
-
DEV_MODE =
|
| 68 |
|
| 69 |
if DEV_MODE:
|
| 70 |
print("Running in DEV_MODE - Hot reload enabled")
|
|
@@ -203,7 +203,7 @@ app, rt = fast_app(
|
|
| 203 |
before=bware,
|
| 204 |
live=DEV_MODE,
|
| 205 |
hdrs=headers,
|
| 206 |
-
middleware=middlewares,
|
| 207 |
key_fname=sess_key_path,
|
| 208 |
samesite="none"
|
| 209 |
)
|
|
@@ -445,17 +445,7 @@ async def login(request: Request):
|
|
| 445 |
|
| 446 |
if username == ADMIN_NAME and compare_digest(ADMIN_PWD.encode("utf-8"), password.encode("utf-8")):
|
| 447 |
request.session["auth"] = True
|
| 448 |
-
|
| 449 |
-
# Set "set-cookie" in header
|
| 450 |
-
response.set_cookie(
|
| 451 |
-
"session",
|
| 452 |
-
request.session,
|
| 453 |
-
max_age=3600,
|
| 454 |
-
httponly=False,
|
| 455 |
-
samesite='None', # Try 'lax' if 'none' doesn't work
|
| 456 |
-
secure=True, # Set to True if your site uses HTTPS
|
| 457 |
-
)
|
| 458 |
-
return response
|
| 459 |
|
| 460 |
return RedirectResponse("/login?error=True", status_code=303)
|
| 461 |
|
|
|
|
| 64 |
import uuid
|
| 65 |
import secrets
|
| 66 |
|
| 67 |
+
DEV_MODE = True
|
| 68 |
|
| 69 |
if DEV_MODE:
|
| 70 |
print("Running in DEV_MODE - Hot reload enabled")
|
|
|
|
| 203 |
before=bware,
|
| 204 |
live=DEV_MODE,
|
| 205 |
hdrs=headers,
|
| 206 |
+
#middleware=middlewares,
|
| 207 |
key_fname=sess_key_path,
|
| 208 |
samesite="none"
|
| 209 |
)
|
|
|
|
| 445 |
|
| 446 |
if username == ADMIN_NAME and compare_digest(ADMIN_PWD.encode("utf-8"), password.encode("utf-8")):
|
| 447 |
request.session["auth"] = True
|
| 448 |
+
return RedirectResponse("/admin", status_code=303)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 449 |
|
| 450 |
return RedirectResponse("/login?error=True", status_code=303)
|
| 451 |
|