Update auth.py
Browse files
auth.py
CHANGED
@@ -54,13 +54,13 @@ def authenticate_user(db: Session, email: str, password: str):
|
|
54 |
from emailx import send_verification_email, generate_verification_token
|
55 |
|
56 |
def verify_email(self, verification_token: str, db: Session = Depends(get_db)):
|
57 |
-
# Verify the email using the token
|
58 |
-
|
59 |
-
if not
|
60 |
raise HTTPException(status_code=400, detail="Invalid verification token")
|
61 |
|
62 |
# Get the user by email
|
63 |
-
user =
|
64 |
if not user:
|
65 |
raise HTTPException(status_code=400, detail="User not found")
|
66 |
|
|
|
54 |
from emailx import send_verification_email, generate_verification_token
|
55 |
|
56 |
def verify_email(self, verification_token: str, db: Session = Depends(get_db)):
|
57 |
+
# Verify the email using the token
|
58 |
+
user_email = verify_token(verification_token)
|
59 |
+
if not user_email:
|
60 |
raise HTTPException(status_code=400, detail="Invalid verification token")
|
61 |
|
62 |
# Get the user by email
|
63 |
+
user = get_user_by_email(db, user_email)
|
64 |
if not user:
|
65 |
raise HTTPException(status_code=400, detail="User not found")
|
66 |
|