Commit graph

2801 commits

Author SHA1 Message Date
Max
721f47c345 Enhance invitation acceptance flow with invitation ID support
- Updated the AcceptInvitation method to require both invitation ID and token, improving the invitation acceptance process.
- Modified related tests to accommodate the new invitation ID parameter, ensuring comprehensive coverage of acceptance scenarios.
- Enhanced the invitation acceptance endpoint to validate invitation ID, providing clearer error handling for invalid or expired invitations.
- Refactored tests to include detailed scenarios for accepting invitations, including success and failure cases, ensuring robust testing of the invitation flow.
2025-10-14 11:58:20 +08:00
Max
0d83faeeca Add Yao user ID support in OIDC and token generation
- Enhanced the SignIDToken method to include the original Yao user ID in the token claims, improving user identification.
- Updated the MakeOIDCUserInfo function to extract and set the Yao user ID from the user map, ensuring consistency in user information.
- Modified the OIDCUserInfo structure to include a field for Yao user ID, facilitating better integration with Yao-specific features.
- Adjusted the team invitation response to include the inviter's user ID, enhancing the invitation context.
2025-10-14 09:56:29 +08:00
Max
5e67a9e5c0 Add Yao type information to user and token claims
- Enhanced the OIDCUserInfo structure to include YaoTypeID and YaoType fields for better user type management.
- Updated SignIDToken method to incorporate YaoTypeID and YaoType claims, ensuring comprehensive user type information in ID tokens.
- Modified team creation logic to set default type_id based on team configuration, improving team management capabilities.
- Refactored token generation methods to support additional type information in access and refresh tokens, enhancing overall token customization.
2025-10-13 18:26:52 +08:00
Max
a4c628f3c2 Add register configuration support for user management
- Introduced register configuration loading from the openapi/user/register directory, enhancing user management capabilities.
- Updated LoginThirdParty function to utilize locale-specific register configurations, improving localization support.
- Refactored RegisterConfig structure to include additional fields for better configuration management.
- Enhanced GetRegisterConfig function to provide fallback options for missing locale configurations, ensuring robustness in user registration processes.
2025-10-13 16:44:17 +08:00
Max
87465379be Enhance user type management with locale support
- Added 'locale' field to user type structure for language localization.
- Updated API methods to include locale in pricing and published types retrieval.
- Enhanced tests to validate locale handling in user type operations, ensuring robust support for multiple languages.
2025-10-13 16:16:40 +08:00
Max
15f0750253 Enhance user type management with pricing and status fields
- Updated user type structure to include new fields for pricing: price_daily, price_monthly, price_yearly, and credits_monthly.
- Added status field to manage publishing states (draft, published, archived) for user types.
- Enhanced the user type API to support pricing operations, including retrieval and updates for pricing information.
- Refactored tests to cover new pricing functionalities and ensure robust handling of user type statuses.
2025-10-13 15:55:41 +08:00
Max
ba296c3b48 Update UpdateUserLastLogin method to require loginCtx
- Modified the UpdateUserLastLogin method to validate that loginCtx is not nil, returning an error if it is.
- Updated the corresponding test to reflect this change, ensuring that an error is asserted when loginCtx is nil, improving error handling and robustness of user login tracking.
2025-10-13 14:11:28 +08:00
Max
0a353e6e41 Add Yao custom fields to ID token claims
- Enhanced the SignIDToken method to include additional Yao-specific fields such as tenant_id, team_id, is_owner, and team details in the token claims.
- Improved the structure of claims to support team information, ensuring comprehensive metadata is included in the generated tokens.
2025-10-13 11:29:45 +08:00
Max
1af0a20015 Enhance user login functionality with detailed context tracking
- Updated the UpdateUserLastLogin method to accept a LoginContext, allowing for tracking of last login IP, user agent, device, and platform.
- Modified the LoginThirdParty and LoginByUserID functions to utilize the new LoginContext, improving the accuracy of login tracking.
- Enhanced the user model to include fields for last login details, ensuring comprehensive user activity logging.
- Refactored tests to validate the new login context handling, ensuring robust coverage of the updated functionality.
2025-10-13 09:58:16 +08:00
Max
d78ed77b9e Enhance token generation and storage to support optional extra claims
- Updated methods related to refresh token generation and storage to accept optional extra claims, allowing for additional metadata such as team_id and tenant_id.
- Refactored tests to utilize the new method signatures, ensuring comprehensive coverage of the updated functionality.
- Introduced a new endpoint for team selection that issues tokens with team-specific claims, improving user experience in multi-team scenarios.
2025-10-11 19:56:29 +08:00
Max
aae3447575 Refactor token claims structure for improved readability
- Removed unnecessary blank lines in the TokenClaims, AuthorizedInfo, and JWTClaims structs to enhance code clarity and maintainability.
- Ensured consistent formatting across the claims structures for better organization.
2025-10-11 19:04:39 +08:00
Max
07cc11b363 Refactor token handling to support optional extra claims in access token generation
- Updated storeAccessToken and related methods to accept an optional extraClaims parameter for additional flexibility.
- Modified MakeAccessToken and generateAccessTokenWithScope functions to incorporate extra claims, enhancing token customization.
- Adjusted tests to utilize the new extraClaims parameter, ensuring comprehensive coverage of the updated functionality.
2025-10-11 18:59:45 +08:00
Max
60c830099e Enhance login process to support team selection and improve token handling
- Added ScopeTeamSelection constant for temporary access token.
- Updated LoginByUserID function to include team selection logic based on user team count.
- Modified access token generation to use user subject for both MFA and team selection scenarios.
- Enhanced LoginResponse structure to include TokenType and Scope fields for clarity.
2025-10-11 18:23:09 +08:00
Max
afa5b2d3f2 Enhance team retrieval functionality and improve user team handling
- Updated GetTeamsByMember method to include role information and owner status for each team member.
- Refactored GinTeamList to utilize the new getUserTeams function, simplifying team retrieval logic and removing pagination.
- Introduced getUserTeams and getUserTeamsCount functions to encapsulate team membership logic, improving code organization and clarity.
- Removed deprecated team retrieval logic from user/team.go, streamlining the codebase.
2025-10-11 10:54:51 +08:00
Max
6abcf79dd7 Refactor MFA handling in login process
- Updated LoginResponse structure to replace MFAToken and MFATokenExpiresIn with AccessToken and ExpiresIn for improved clarity.
- Adjusted LoginByUserID and SendLoginCookies functions to utilize the new access token fields.
- Modified authback function to respond with the updated login response structure, enhancing the MFA flow.
2025-10-10 14:51:01 +08:00
Max
4a93b3580c Implement MFA token generation and update login response handling
- Removed the previous MFA check from the LoginThirdParty function and integrated MFA token generation within the LoginByUserID function.
- Enhanced the LoginResponse structure to include MFAToken and MFATokenExpiresIn fields for better MFA handling.
- Updated the SendLoginCookies function to manage MFA token cookies appropriately.
- Adjusted the authback function to respond with MFA status and token when MFA is required, improving the login flow for users with MFA enabled.
2025-10-10 14:25:18 +08:00
Max
5e5b633fba Add team retrieval and counting methods for user membership
- Introduced GetTeamsByMember and CountTeamsByMember methods in the DefaultUser struct to retrieve teams associated with a specific member and count the total number of teams, respectively.
- Updated the UserProvider interface to include these new methods.
- Enhanced the login response structure to include a status indicating whether team selection is required based on the user's team membership.
- Added error handling for team retrieval in the authentication process.
2025-10-10 11:57:47 +08:00
Max
4a94460377 Add MFA required error handling and update login response structure 2025-10-10 11:14:52 +08:00
Max
2569634ca2 Remove invitation management handlers and related business logic
- Deleted the invitation.go file, which contained handlers for team invitation management, including listing, creating, resending, and deleting invitations.
- Updated the user/member.go and user/team.go files to ensure consistent response handling by replacing direct JSON responses with a unified response method.
- Introduced a new PublicInvitationResponse type in user/types.go to facilitate public access to invitation details while excluding sensitive information.
- Refactored user/user.go to register new invitation-related process handlers for improved organization and clarity.
2025-10-10 08:42:05 +08:00
Max
ffbe10f862 Update template tests to align with actual template variables and improve consistency
- Modified test data in template tests to include 'invitation_link' and 'expires_at' fields, ensuring alignment with the actual template structure.
- Changed message type verification from "mail" to "email" for clarity and accuracy.
- Enhanced comments for better understanding of test data relevance.
2025-10-09 15:43:57 +08:00
Max
03ecf96b51 Enhance messenger service with optional message type support for template sending
- Updated SendT, SendTWithProvider, SendTBatch, and SendTBatchMixed methods to accept an optional message type parameter, allowing for more flexible template usage.
- Refactored provider implementations for Mailgun, Twilio, and Mailer to accommodate the new message type parameter in their SendT and SendTBatch methods.
- Improved error handling for template retrieval and provider configuration, ensuring clearer feedback in case of issues.
- Added tests to validate the new functionality and ensure compatibility across different message types.
2025-10-09 12:11:54 +08:00
Max
cf42d255d3 Enhance invitation handling and team configuration tests
- Updated the invitation creation response to return complete invitation details, including the invitation token.
- Improved error handling when retrieving created invitations, ensuring fallback to ID return on failure.
- Modified team configuration tests to require authentication, reflecting recent API changes.
- Added access token retrieval for authenticated requests in team configuration tests, enhancing security and compliance.
2025-10-08 17:56:56 +08:00
Max
c6329ebb0c Refactor settings handling in user invitation, member, and team APIs
- Updated the structure of settings in invitation, member, and team responses to use specific types instead of generic maps for better type safety and clarity.
- Implemented backward compatibility for existing settings formats to ensure seamless integration with previous data structures.
- Enhanced the logic for handling settings in invitation creation and response mapping, improving maintainability and readability of the codebase.
2025-10-08 16:46:31 +08:00
Max
ca2344edb8 Refactor invitation handling and improve test coverage
- Updated invitation creation logic to support email invitations and customizable expiry durations.
- Enhanced tests for invitation creation, including scenarios for registered and unregistered users, and handling of missing email requirements.
- Refactored API endpoints to use consistent parameter naming for team IDs.
- Improved error handling and logging for invitation-related operations, ensuring clarity in failure cases.
- Added support for sending invitation emails through the messenger service, with appropriate templates and settings.
2025-10-08 16:16:49 +08:00
Max
bd463b0ec5 Refactor template tests to improve readability and consistency
- Cleaned up whitespace in debug, load, and walk test files for better formatting.
- Enhanced logging statements for clarity during template loading and walking tests.
- Standardized test structure to improve maintainability and readability across template-related tests.
2025-10-08 09:22:28 +08:00
Max
ec8b6c336b Enhance messenger service with template support for message sending
- Introduced template loading functionality during messenger initialization, allowing for dynamic message templates.
- Added SendT, SendTWithProvider, SendTBatch, and SendTBatchMixed methods to the Service for sending messages using templates.
- Updated provider implementations for Mailgun, Twilio, and Mailer to support template-based message sending.
- Enhanced the Provider interface to include optional template methods, improving flexibility and usability across providers.
2025-10-08 09:21:57 +08:00
Max
d113adaa8a Refactor test files to improve readability and consistency
- Cleaned up whitespace in user configuration validation and environment variable extraction tests.
- Enhanced logging statements for better clarity during test execution.
- Standardized formatting across test cases to improve maintainability.
2025-10-07 10:32:35 +08:00
Max
9044d4c30a Enhance user login and team configuration management
- Updated login configuration tests to clarify endpoint descriptions.
- Introduced team configuration loading and retrieval functionality, including new endpoints for public access to team configurations.
- Refactored team management routes to standardize parameter usage and improve clarity.
- Added error handling for missing environment variables in client configuration.
- Implemented team configuration types and related structures for better organization and usability.
2025-10-07 10:23:43 +08:00
Max
f0d56b91ad Update Makefile to exclude 'twilio' from test folder and clean up whitespace in mailer and mailgun provider files 2025-09-28 16:13:29 +08:00
Max
436d101cf3 Add GetAllProviders method and related tests for provider information retrieval
- Implemented GetAllProviders method in the Service to return all registered providers.
- Added TestGetAllProviders to validate the functionality, ensuring providers have required attributes and are unique.
- Enhanced GetPublicInfo method in provider implementations to return structured public information.
- Updated OpenAPI handlers to include endpoints for retrieving provider information, improving API usability.
2025-09-28 16:00:35 +08:00
Max
0505adf003 Refactor messenger service to enhance webhook processing and remove deprecated methods
- Implemented TriggerWebhook method to handle incoming webhook requests for various providers, utilizing gin.Context for improved integration.
- Removed the deprecated Receive method from the mailer provider and related functions, streamlining the codebase.
- Updated tests to reflect changes in webhook handling and provider interactions, ensuring compatibility with new implementations.
- Enhanced error handling and logging for webhook processing, improving overall reliability and clarity.
2025-09-28 15:27:20 +08:00
Max
c425b74383 Refactor error handling in various components to improve logging and message formatting
- Updated error messages to use fmt.Errorf with %s for better clarity and consistency.
- Enhanced logging statements to utilize formatted strings for improved readability.
- Refactored multiple Load functions across different modules to standardize error handling practices.
2025-09-28 10:24:17 +08:00
Max
ffc666c4de Enhance messenger service with message handler registration and webhook processing
- Introduced OnReceive method to register multiple message handlers for processing received messages.
- Added RemoveReceiveHandler method to unregister specific message handlers.
- Implemented TriggerWebhook method to process incoming webhook data and trigger registered handlers.
- Updated existing tests to reflect changes in provider types from 'smtp' to 'mailer' for consistency.
2025-09-28 10:00:38 +08:00
Max
1843a64ff5 Update dependencies and enhance mailer functionality
- Bump Go version to 1.24.0 and update toolchain to 1.24.3 for improved performance and compatibility.
- Add new dependencies for IMAP and SASL support, enhancing email handling capabilities.
- Refactor messenger service to integrate a new mailer provider, replacing the deprecated SMTP provider.
- Implement automatic mail receiver startup for mailer providers, improving message handling efficiency.
- Update GitHub Actions workflows to include IMAP server configurations for testing email reception.
2025-09-28 09:33:36 +08:00
Max
09ec6edac3 Enhance Twilio provider tests and configurations for improved SMS functionality
- Added TWILIO_TEST_PHONE environment variable to GitHub Actions workflows for better test configuration.
- Updated Twilio SMS test cases to utilize the new test phone number, improving test reliability.
- Implemented separate test cases for SMS sending using both Auth Token and API Key authentication methods.
- Enhanced existing tests to skip execution if required credentials are not configured, ensuring clearer test outcomes.
- Refactored benchmark tests for SMS sending to support both authentication methods, optimizing performance evaluation.
2025-09-27 08:41:42 +08:00
Max
d0964c942d Refactor Twilio provider methods to include context support
- Updated method signatures for sendSMS, sendWhatsApp, and their respective recipient functions to accept context.Context as a parameter.
- Modified request handling in sendTwilioRequest to utilize context, improving request management and error handling.
- Enhanced overall functionality and maintainability of the Twilio provider by integrating context support.
2025-09-26 19:01:05 +08:00
Max
fecbc87ba8 Update Mailgun test to validate delivery time format with timezone offset
- Modified the test for scheduled email delivery to assert that the delivery time includes a timezone offset in the RFC1123Z format.
- Replaced the previous check for "GMT" with a regex assertion to ensure compliance with the expected format.
2025-09-26 18:44:11 +08:00
Max
ae8efd247a Refactor SMTP provider implementation for improved clarity and functionality
- Renamed SMTPProvider to Provider for consistency across messenger providers.
- Updated method signatures to reflect the new Provider type.
- Added extractEmailAddress function to handle email address extraction from formatted strings.
- Enhanced sendEmail and sendWithTLS methods to support context and improve error handling.
- Refactored message building and sending logic for better maintainability.
2025-09-26 18:37:37 +08:00
Max
9438c6831a Refactor messaging service configurations for improved CI integration
- Enhanced GitHub Actions workflows by refining Mailgun, SMTP, and Twilio configurations for better unit and PR testing.
- Streamlined environment variable management for email and SMS services, ensuring consistent and secure credential handling.
- Updated related tests to validate the new configuration setup, improving overall reliability in communication functionalities.
2025-09-26 18:16:56 +08:00
Max
551af8cf0a Add messaging service configurations to CI workflows
- Integrated Mailgun, SMTP, and Twilio environment variables into the GitHub Actions workflows for unit testing and PR testing.
- Configured necessary credentials and settings for Mailgun and Gmail SMTP servers, enhancing email functionality.
- Added Twilio configuration for SMS and email services, improving communication capabilities in tests.
2025-09-26 17:43:03 +08:00
Max
c9917f8193 Enhance messenger functionality with context support and environment variable resolution
- Added context support to Send and SendBatch methods across all messenger providers (Twilio, Mailgun, SMTP).
- Implemented environment variable resolution in provider configurations to enhance flexibility.
- Updated Load function in the engine to include messenger loading, ensuring all components are initialized properly.
- Refactored related tests to validate new context handling and configuration parsing, improving overall robustness.
2025-09-26 17:39:10 +08:00
Max
d12ce099c3 Add API Key authentication support in Twilio provider
- Introduced optional API Key and API SID fields for enhanced authentication.
- Updated validation logic to require either an auth token or both API SID and API Key.
- Modified request handling to prioritize API Key authentication over auth token, improving security and flexibility.
2025-09-26 16:34:23 +08:00
Max
9ce1bb60cf
Merge pull request #1161 from trheyi/main
Implement team member invitation expiration handling
2025-09-25 10:34:10 +08:00
Max
9e0afa3f42 Implement team member invitation expiration handling
- Added functionality to manage expiration of member invitations, ensuring that outdated invitations are automatically invalidated.
- Updated invitation-related data structures to include expiration timestamps for better tracking.
- Enhanced the invitation workflow by implementing checks for expired invitations during member management operations.
- Refactored related tests to cover new expiration logic, ensuring robust validation of invitation handling.
2025-09-25 10:33:35 +08:00
Max
5bbdfa3286
Merge pull request #1160 from trheyi/main
Add team ownership and membership checks in user management
2025-09-23 17:48:03 +08:00
Max
b9a912b7d9 Enhance member invitation management and related functionality
- Introduced invitation_id handling for member management, allowing for unique identification of pending invitations.
- Added methods to create, update, and remove members by invitation_id, improving the invitation workflow.
- Updated member data structures and API responses to include invitation-related fields, enhancing clarity and usability.
- Implemented tests for invitation ID operations, ensuring robust validation and error handling.
- Refactored team access checks to streamline member management processes.
2025-09-23 17:47:43 +08:00
Max
35afc1d58c Add team ownership and membership checks in user management
- Introduced IsTeamOwner and IsTeamMember methods to verify user ownership and membership status within a team.
- Added CheckTeamAccess method to assess a user's access level, returning ownership and membership status.
- Enhanced user types with new MemberResponse and MemberDetailResponse structures for improved member management.
- Updated routing for team member management to utilize new handler functions for clarity and consistency.
2025-09-23 16:14:42 +08:00
Max
eb68c72967
Merge pull request #1159 from trheyi/main
Add team member removal functionality and related tests
2025-09-23 11:25:24 +08:00
Max
9aff88d2fc Add team member removal functionality and related tests
- Implemented RemoveAllTeamMembers method in DefaultUser to delete all members from a team during team deletion.
- Added TestTeamDeleteMemberCleanup to verify that all members are removed when a team is deleted.
- Refactored team creation and deletion logic to ensure proper member management and error handling during these operations.
2025-09-23 11:24:57 +08:00
Max
c24bda7a21
Merge pull request #1158 from trheyi/main
Remove unnecessary blank line in test utility function to enhance cod…
2025-09-23 10:30:46 +08:00