Mark-Lasfar
commited on
Commit
·
6bd3a21
1
Parent(s):
5da2025
Update backend and server frontend for OAuth JSON response, client-side navigation, and add .gitignore
Browse files- init_db.py +7 -3
- requirements.txt +1 -0
init_db.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
-
# init_db.py
|
| 2 |
# SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
|
| 3 |
-
# SPDX-License-
|
| 4 |
|
| 5 |
import os
|
| 6 |
import logging
|
|
@@ -54,9 +53,14 @@ async def init_db():
|
|
| 54 |
select(User).filter_by(email="test@example.com")
|
| 55 |
)).scalar_one_or_none()
|
| 56 |
if not test_user:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
test_user = User(
|
| 58 |
email="test@example.com",
|
| 59 |
-
hashed_password=pwd_context.hash(
|
| 60 |
is_active=True,
|
| 61 |
display_name="Test User"
|
| 62 |
)
|
|
|
|
|
|
|
| 1 |
# SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
|
| 2 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
|
| 4 |
import os
|
| 5 |
import logging
|
|
|
|
| 53 |
select(User).filter_by(email="test@example.com")
|
| 54 |
)).scalar_one_or_none()
|
| 55 |
if not test_user:
|
| 56 |
+
# استخدام كلمة مرور أقصر لتجنب مشكلة bcrypt
|
| 57 |
+
test_password = "testpass"
|
| 58 |
+
if len(test_password.encode('utf-8')) > 72:
|
| 59 |
+
logger.error("Test password is too long for bcrypt (>72 bytes)")
|
| 60 |
+
raise ValueError("Test password is too long for bcrypt (>72 bytes)")
|
| 61 |
test_user = User(
|
| 62 |
email="test@example.com",
|
| 63 |
+
hashed_password=pwd_context.hash(test_password),
|
| 64 |
is_active=True,
|
| 65 |
display_name="Test User"
|
| 66 |
)
|
requirements.txt
CHANGED
|
@@ -7,6 +7,7 @@ aiosqlite==0.21.0
|
|
| 7 |
sqlalchemy==2.0.43
|
| 8 |
python-jose[cryptography]==3.3.0
|
| 9 |
passlib[bcrypt]==1.7.4
|
|
|
|
| 10 |
httpx-oauth==0.16.1
|
| 11 |
python-multipart==0.0.6
|
| 12 |
uvicorn==0.30.6
|
|
|
|
| 7 |
sqlalchemy==2.0.43
|
| 8 |
python-jose[cryptography]==3.3.0
|
| 9 |
passlib[bcrypt]==1.7.4
|
| 10 |
+
bcrypt==4.1.3
|
| 11 |
httpx-oauth==0.16.1
|
| 12 |
python-multipart==0.0.6
|
| 13 |
uvicorn==0.30.6
|