Skip to content

Commit

Permalink
additional validation for user auth
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Dec 17, 2024
1 parent 0f2a8ac commit 07a7816
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion backend/ee/onyx/server/tenants/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def register_tenant_users(tenant_id: str, number_of_users: int) -> stripe.Subscr
"""
Send a request to the control service to register the number of users for a tenant.
"""
return
if not STRIPE_PRICE_ID:
raise Exception("STRIPE_PRICE_ID is not set")

Expand Down
9 changes: 6 additions & 3 deletions backend/onyx/server/manage/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ def deactivate_user(
def delete_user_from_db(
user_to_delete: User,
db_session: Session,
user_email: UserByEmail,
) -> None:
for oauth_account in user_to_delete.oauth_accounts:
db_session.delete(oauth_account)
Expand Down Expand Up @@ -379,7 +378,11 @@ def delete_user_from_db(
# NOTE: edge case may exist with race conditions
# with this `invited user` scheme generally.
user_emails = get_invited_users()
remaining_users = [user for user in user_emails if user != user_email.user_email]
remaining_users = [
remaining_user_email
for remaining_user_email in user_emails
if remaining_user_email != user_to_delete.email
]
write_invited_users(remaining_users)

logger.info(f"Deleted user {user_to_delete.email}")
Expand Down Expand Up @@ -409,7 +412,7 @@ async def delete_user(
db_session.expunge(user_to_delete)

try:
delete_user_from_db(user_to_delete, db_session, user_email)
delete_user_from_db(user_to_delete, db_session)
logger.info(f"Deleted user {user_to_delete.email}")

except Exception as e:
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/admin/users/SignedUpUserTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ const SignedUpUserTable = ({
onPageChange,
mutate,
}: Props & PageSelectorProps) => {
if (!users.length) return null;
const { user: currentUser } = useUser();

if (!users.length) return null;

const handlePopup = (message: string, type: "success" | "error") => {
if (type === "success") mutate();
setPopup({ message, type });
Expand Down

0 comments on commit 07a7816

Please sign in to comment.