-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
+866
−141
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
8 tasks
There was a problem hiding this 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
) toworkspace
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
...ver/src/database/typeorm/core/migrations/1730298416367-addAuthProvidersColumnsToWorkspace.ts
Show resolved
Hide resolved
...ver/src/database/typeorm/core/migrations/1730298416367-addAuthProvidersColumnsToWorkspace.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/auth/dto/available-workspaces.output.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/auth/dto/available-workspaces.output.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/auth/dto/available-workspaces.output.ts
Show resolved
Hide resolved
...server/src/engine/core-modules/workspace-invitation/services/workspace-invitation.service.ts
Outdated
Show resolved
Hide resolved
...server/src/engine/core-modules/workspace-invitation/services/workspace-invitation.service.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/workspace/workspace.exception.ts
Outdated
Show resolved
Hide resolved
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
Close for #8653 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.