argon
This commit is contained in:
@@ -33,12 +33,6 @@ from backend.db import engine, get_db # noqa: E402
|
||||
from backend.models import Base, User # noqa: E402
|
||||
|
||||
|
||||
def _password_ok_or_400(password: str):
|
||||
# bcrypt has a 72-byte input limit (bytes, not chars)
|
||||
if len(password.encode("utf-8")) > 72:
|
||||
raise HTTPException(status_code=400, detail="Password is too long (max 72 bytes for bcrypt)")
|
||||
|
||||
|
||||
class GenerationRequest(BaseModel):
|
||||
description: str
|
||||
platform: str = "GitHub Actions" # or GitLab CI
|
||||
@@ -94,7 +88,6 @@ def register(req: RegisterRequest, db: Session = Depends(get_db)):
|
||||
if not email or not req.password:
|
||||
raise HTTPException(status_code=400, detail="Email and password are required")
|
||||
pw_bytes_len = len(req.password.encode("utf-8"))
|
||||
_password_ok_or_400(req.password)
|
||||
|
||||
try:
|
||||
exists = db.execute(select(User).where(User.email == email)).scalar_one_or_none()
|
||||
@@ -130,7 +123,6 @@ def login(req: LoginRequest, db: Session = Depends(get_db)):
|
||||
email = req.email.strip().lower()
|
||||
if not req.password:
|
||||
raise HTTPException(status_code=400, detail="Password is required")
|
||||
_password_ok_or_400(req.password)
|
||||
try:
|
||||
user = db.execute(select(User).where(User.email == email)).scalar_one_or_none()
|
||||
if not user or not verify_password(req.password, user.password_hash):
|
||||
|
||||
Reference in New Issue
Block a user