Fix user generation with email_prefix to support multiple users#689
Open
socksprox wants to merge 1 commit intocedar2025:masterfrom
Open
Fix user generation with email_prefix to support multiple users#689socksprox wants to merge 1 commit intocedar2025:masterfrom
socksprox wants to merge 1 commit intocedar2025:masterfrom
Conversation
Author
|
@cedar2025 Please check it out, I tested this commit on my developing xboard instance and it worked well |
This file contains hidden or 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
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.
Problem
When using the user generation endpoint with both
email_prefixandgenerate_countparameters, only one user was being created instead of the specified count.For example, this request would only generate 1 user instead of 5:
{ "email_prefix": "company", "email_suffix": "example.com", "password": "password123", "expired_at": 1757973600, "plan_id": 5, "generate_count": 5, "download_csv": false }Solution
generate()method to properly handle bothemail_prefixandgenerate_countparametersmultiGenerateWithPrefix()method for bulk user creation with prefixed emailsprefix_1@domain.com,prefix_2@domain.com, etc.Changes Made
generate()method: Added logic to callmultiGenerateWithPrefix()when bothemail_prefixandgenerate_countare providedmultiGenerateWithPrefix()method: New method that generates multiple users with incremented email prefixesTesting
The fix has been tested with the original failing request and now properly generates 5 users with emails:
company_1@example.comcompany_2@example.comcompany_3@example.comcompany_4@example.comcompany_5@example.comBackward Compatibility
✅ Single user generation (no
generate_count) continues to work as before✅ Multiple user generation without
email_prefix(random emails) continues to work as before✅ All existing functionality is preserved