Gregniuki commited on
Commit
841d578
1 Parent(s): a982c5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -1,7 +1,7 @@
1
  from fastapi.security import OAuth2PasswordBearer
2
  from pydantic import BaseModel
3
  from sqlalchemy.orm import Session
4
- from database import get_db, get_user_by_email, get_user_by_verification_token
5
  from models import User
6
  from passlib.context import CryptContext
7
  from datetime import datetime, timedelta
@@ -125,6 +125,8 @@ def register_user(user_data: UserCreate, db: Session):
125
  db.commit()
126
  db.refresh(new_user)
127
  return new_user
 
 
128
 
129
  def reset_password(user: User, db: Session):
130
  verification_token = generate_verification_token(user.email)
 
1
  from fastapi.security import OAuth2PasswordBearer
2
  from pydantic import BaseModel
3
  from sqlalchemy.orm import Session
4
+ from database import get_db, get_user_by_email
5
  from models import User
6
  from passlib.context import CryptContext
7
  from datetime import datetime, timedelta
 
125
  db.commit()
126
  db.refresh(new_user)
127
  return new_user
128
+ def get_user_by_verification_token(db: Session, verification_token: str):
129
+ return db.query(User).filter(User.email_verification_token == verification_token).first()
130
 
131
  def reset_password(user: User, db: Session):
132
  verification_token = generate_verification_token(user.email)