Gregniuki commited on
Commit
db4e025
·
1 Parent(s): 0bcfe06

Update auth.py

Browse files
Files changed (1) hide show
  1. auth.py +4 -4
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 (implement email.verify_token)
58
- emaila = email.verify_token(verification_token)
59
- if not emaila:
60
  raise HTTPException(status_code=400, detail="Invalid verification token")
61
 
62
  # Get the user by email
63
- user = database.get_user_by_email(db, emaila)
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