Update auth.py
Browse files
auth.py
CHANGED
@@ -24,7 +24,7 @@ class UserCreate(BaseModel):
|
|
24 |
username: str
|
25 |
password: str
|
26 |
|
27 |
-
|
28 |
# Validate email format and check for existing users
|
29 |
db_user = database.get_user_by_email(db, user.email)
|
30 |
if db_user:
|
@@ -45,7 +45,7 @@ class UserCreate(BaseModel):
|
|
45 |
db.refresh(user_in_db)
|
46 |
return user_in_db
|
47 |
|
48 |
-
|
49 |
# Verify the email using the token (implement email.verify_token)
|
50 |
email = email.verify_token(verification_token)
|
51 |
if not email:
|
|
|
24 |
username: str
|
25 |
password: str
|
26 |
|
27 |
+
def register(self, user: UserCreate, db: Session = Depends(get_db)):
|
28 |
# Validate email format and check for existing users
|
29 |
db_user = database.get_user_by_email(db, user.email)
|
30 |
if db_user:
|
|
|
45 |
db.refresh(user_in_db)
|
46 |
return user_in_db
|
47 |
|
48 |
+
def verify_email(self, verification_token: str, db: Session = Depends(get_db)):
|
49 |
# Verify the email using the token (implement email.verify_token)
|
50 |
email = email.verify_token(verification_token)
|
51 |
if not email:
|