fix: Applied fix for name, the oracle team sharing, sentinel client list visibility
This commit is contained in:
@@ -34,13 +34,19 @@ ROLE_HIERARCHY = {
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
|
||||
|
||||
def _truncate_bcrypt_input(value: str) -> str:
|
||||
raw = value.encode("utf-8")
|
||||
if len(raw) <= 72:
|
||||
return value
|
||||
return raw[:72].decode("utf-8", errors="ignore")
|
||||
|
||||
|
||||
def hash_password(plain: str) -> str:
|
||||
return pwd_context.hash(plain)
|
||||
return pwd_context.hash(_truncate_bcrypt_input(plain))
|
||||
|
||||
|
||||
def verify_password(plain: str, hashed: str) -> bool:
|
||||
# Truncate to 72 bytes to prevent bcrypt 500 errors
|
||||
return pwd_context.verify(plain[:72], hashed)
|
||||
return pwd_context.verify(_truncate_bcrypt_input(plain), hashed)
|
||||
|
||||
|
||||
# ── JWT helpers ───────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user