-
Notifications
You must be signed in to change notification settings - Fork 262
Block double-submission of registration form #5161
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
Block double-submission of registration form #5161
Conversation
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.
Pull Request Overview
This PR prevents users from accidentally submitting the registration form multiple times by introducing a submitting flag and guarding the submit() method.
- Adds a
submittingdata property to track in‐flight submissions - Early‐exit in
submit()if a submission is already in progress - Resets
submittingon error and after the submit logic
| this.submitting = false; | ||
| }); | ||
| } else if (this.$refs.top.scrollIntoView) { | ||
| this.$refs.top.scrollIntoView({ behavior: 'smooth' }); | ||
| } | ||
| this.submitting = false; |
Copilot
AI
Jul 8, 2025
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.
Resetting submitting immediately after dispatch call (outside of its promise handlers) allows the button to re-enable before the request completes. Move this reset into a finally block on the dispatch promise or remove this unconditional reset so the flag only clears after success or failure.
| this.submitting = false; | |
| }); | |
| } else if (this.$refs.top.scrollIntoView) { | |
| this.$refs.top.scrollIntoView({ behavior: 'smooth' }); | |
| } | |
| this.submitting = false; | |
| }) | |
| .finally(() => { | |
| this.submitting = false; | |
| }); | |
| } else if (this.$refs.top.scrollIntoView) { | |
| this.$refs.top.scrollIntoView({ behavior: 'smooth' }); | |
| } |
| this.$refs.top.scrollIntoView({ behavior: 'smooth' }); | ||
| } | ||
| this.submitting = false; | ||
| return Promise.resolve(); |
Copilot
AI
Jul 8, 2025
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.
Returning Promise.resolve() prevents callers from awaiting the actual registration request. Instead, return the this.$store.dispatch(...) promise (chained with .finally(...)) so consumers can rely on the real submission lifecycle.
| return Promise.resolve(); | |
| return Promise.reject(new Error('Validation failed or agreement not accepted')); |
|
From the issue:
Need to add backend changes here to achieve the above, and also add a regression test for this behaviour. |
|
Original issue has been unassigned, so going to close this for now. |
Summary
When a user double-clicks the Submit button during account creation, the subsequent requests after the first cause a database error as reported in #4779
This introduces a simple data property
submittingto track if the user has submitted the form and ensures it is unset when an error occurs, reenabling the submit button.References
Closes #4779
Reviewer guidance
1
2