Gregniuki commited on
Commit
7e59b23
·
1 Parent(s): 3ce2714

Update auth.py

Browse files
Files changed (1) hide show
  1. auth.py +5 -3
auth.py CHANGED
@@ -52,16 +52,18 @@ def authenticate_user(db: Session, email: str, password: str):
52
 
53
  from emailx import send_verification_email, generate_verification_token
54
 
55
- #pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
56
 
57
- def register(self, user: UserCreate, db: Session):
 
58
  # Validate email format and check for existing users
59
  db_user = get_user_by_email(db, user.email)
60
  if db_user:
61
  raise HTTPException(status_code=400, detail="Email already registered")
62
 
 
 
63
  # Hash the password
64
- hashed_password = self.pwd_context.hash(user.password)
65
 
66
  # Generate a verification token
67
  verification_token = generate_verification_token(user.email)
 
52
 
53
  from emailx import send_verification_email, generate_verification_token
54
 
 
55
 
56
+
57
+ def register(user: UserCreate, db: Session):
58
  # Validate email format and check for existing users
59
  db_user = get_user_by_email(db, user.email)
60
  if db_user:
61
  raise HTTPException(status_code=400, detail="Email already registered")
62
 
63
+ pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
64
+
65
  # Hash the password
66
+ hashed_password = pwd_context.hash(user.password)
67
 
68
  # Generate a verification token
69
  verification_token = generate_verification_token(user.email)