Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(auth): clean up and enhance sign-in-up logic #8581

Closed
wants to merge 5 commits into from

Conversation

AMoreaux
Copy link
Contributor

@AMoreaux AMoreaux commented Nov 19, 2024

The Pull Request introduces new authentication provider columns to the Workspace entity and updates various services and modules to accommodate these changes. It also includes the creation of a new WorkspaceException class.

  • Adds new columns to the Workspace entity for managing authentication providers.
  • Modifies several services (AuthService, WorkspaceService, SignInUpService, etc.) to utilize the new columns.
  • Introduces WorkspaceException for better error handling in workspace-related operations.
  • Updates tests and modules to accommodate the new columns and exception.
  • Includes code format and refactoring for improved readability and maintainability.

Reorganized the sign-in-up code for better readability and maintainability. Introduced validation for workspace invitations and moved some utility functions to dedicated methods. Added a migration for new auth provider columns in the workspace entity.
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR enhances authentication and workspace management by adding configurable auth providers and improving invitation handling.

  • Added auth provider columns (isMicrosoftAuthEnabled, isGoogleAuthEnabled, isPasswordAuthEnabled, isSSOAuthEnabled) to workspace table in /packages/twenty-server/src/database/typeorm/core/migrations/1730298416367-addAuthProvidersColumnsToWorkspace.ts
  • Introduced WorkspaceInvitationService with dedicated validation logic for personal and public invitations in /packages/twenty-server/src/engine/core-modules/workspace-invitation/services/workspace-invitation.service.ts
  • Added getAuthProvidersByWorkspaceId method in /packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts to expose available auth methods per workspace
  • Created new WorkspaceException class in /packages/twenty-server/src/engine/core-modules/workspace/workspace.exception.ts for improved error handling
  • Note: isSSOAuthEnabled column exists in migration but is missing from workspace entity definition

12 file(s) reviewed, 17 comment(s)
Edit PR Review Bot Settings | Greptile

Removed unused `EnvironmentService` and redundant `code` property in exceptions for clarity. Simplified email validation in `workspace-invitation.service.ts`. Refactored tests to remove unnecessary `targetWorkspaceSubdomain` property.
Removed redundant services from auth and core modules to streamline the code. Added debug log statements in sign-in-up service and skipped certain test cases temporarily for evaluation.
Eliminate debug logging for workspace invite tokens and validation. This cleanup improves readability and reduces console clutter during runtime.
…ninup

# Conflicts:
#	packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
@AMoreaux
Copy link
Contributor Author

Close for #8653

@AMoreaux AMoreaux closed this Nov 21, 2024
@AMoreaux AMoreaux deleted the refacto/improve-signinup branch November 21, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant