Fix bcrypt incompatibility: replace passlib with direct bcrypt 5.x API
This commit is contained in:
parent
b09169ade2
commit
6e090eb4dc
3 changed files with 7 additions and 7 deletions
|
|
@ -11,7 +11,7 @@ from databases import Database
|
|||
from sqlalchemy import MetaData, Table, Column, Integer, String, Float, DateTime, text
|
||||
from sqlalchemy import Index, BigInteger, JSON, Boolean, UniqueConstraint
|
||||
from sqlalchemy.sql import func
|
||||
from passlib.hash import bcrypt
|
||||
import bcrypt as _bcrypt
|
||||
|
||||
# Environment: Postgres/TimescaleDB connection URL
|
||||
DATABASE_URL = os.getenv(
|
||||
|
|
@ -364,7 +364,7 @@ async def seed_users():
|
|||
},
|
||||
]
|
||||
for u in default_users:
|
||||
pw_hash = bcrypt.hash(u["password"])
|
||||
pw_hash = _bcrypt.hashpw(u["password"].encode(), _bcrypt.gensalt()).decode()
|
||||
await database.execute(
|
||||
"INSERT INTO users (username, password_hash, is_admin) VALUES (:username, :password_hash, :is_admin)",
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue