Skip to content

Commit

Permalink
fix oauth collection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
emrgnt-cmplxty committed Jan 10, 2025
1 parent 5810cb6 commit 4eb13f2
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions py/core/providers/auth/r2r_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ async def register(
new_user.id, default_collection.id
)

new_user = await self.database_provider.users_handler.get_user_by_id(
new_user.id
)

if self.config.require_email_verification:
verification_code, _ = await self.send_verification_email(
email=email, user=new_user
Expand Down Expand Up @@ -607,14 +611,12 @@ async def oauth_callback_handler(
)
except:
# Create new user
user = (
await self.database_provider.users_handler.create_user(
email=email
or f"{oauth_id}@google_oauth.fake", # fallback
password=None, # no password
account_type="oauth",
google_id=oauth_id,
)
user = await self.register(
email=email
or f"{oauth_id}@google_oauth.fake", # fallback
password=None, # no password
account_type="oauth",
google_id=oauth_id,
)
elif provider == "github":
try:
Expand All @@ -629,14 +631,12 @@ async def oauth_callback_handler(
)
except:
# Create new user
user = (
await self.database_provider.users_handler.create_user(
email=email
or f"{oauth_id}@github_oauth.fake", # fallback
password=None, # no password
account_type="oauth",
github_id=oauth_id,
)
user = await self.register(
email=email
or f"{oauth_id}@github_oauth.fake", # fallback
password=None, # no password
account_type="oauth",
github_id=oauth_id,
)
# else handle other providers

Expand Down

0 comments on commit 4eb13f2

Please sign in to comment.