Fix Dokploy Bad Gateway: panel-first compose and stable boot
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+9
-5
@@ -1,11 +1,15 @@
|
||||
from passlib.context import CryptContext
|
||||
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
import bcrypt
|
||||
|
||||
|
||||
def hash_password(password: str) -> str:
|
||||
return pwd_context.hash(password)
|
||||
raw = password.encode("utf-8")
|
||||
# bcrypt limit is 72 bytes
|
||||
digest = bcrypt.hashpw(raw[:72], bcrypt.gensalt())
|
||||
return digest.decode("utf-8")
|
||||
|
||||
|
||||
def verify_password(password: str, password_hash: str) -> bool:
|
||||
return pwd_context.verify(password, password_hash)
|
||||
try:
|
||||
return bcrypt.checkpw(password.encode("utf-8")[:72], password_hash.encode("utf-8"))
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user