Update main.py
Browse files
main.py
CHANGED
@@ -51,7 +51,7 @@ async def auth_callback(request: Request, db: Session = Depends(get_db)):
|
|
51 |
# Check if this user is already in your database, if not, create a new user record
|
52 |
db_user = db.query(User).filter(User.email == user_info['email']).first()
|
53 |
if not db_user:
|
54 |
-
db_user = User(email=user_info['email'],
|
55 |
db.add(db_user)
|
56 |
db.commit()
|
57 |
db.refresh(db_user)
|
@@ -146,7 +146,7 @@ async def verify_google_token(token_data: TokenData, db: Session = Depends(get_d
|
|
146 |
db_user = db.query(User).filter(User.email == email).first()
|
147 |
if not db_user:
|
148 |
# Create a new user if doesn't exist
|
149 |
-
db_user = User(email=email, is_verified=True,
|
150 |
db.add(db_user)
|
151 |
db.commit()
|
152 |
db.refresh(db_user)
|
|
|
51 |
# Check if this user is already in your database, if not, create a new user record
|
52 |
db_user = db.query(User).filter(User.email == user_info['email']).first()
|
53 |
if not db_user:
|
54 |
+
db_user = User(email=user_info['email'], username=user_info['name'], is_verified=True)
|
55 |
db.add(db_user)
|
56 |
db.commit()
|
57 |
db.refresh(db_user)
|
|
|
146 |
db_user = db.query(User).filter(User.email == email).first()
|
147 |
if not db_user:
|
148 |
# Create a new user if doesn't exist
|
149 |
+
db_user = User(email=email, is_verified=True, username=google_user_info.get('name'))
|
150 |
db.add(db_user)
|
151 |
db.commit()
|
152 |
db.refresh(db_user)
|