Skip to content

fix(core): prevent double-submit on login flow grant page - #62357

Open
okxint wants to merge 1 commit into
nextcloud:masterfrom
okxint:fix/login-flow-grant-double-submit
Open

fix(core): prevent double-submit on login flow grant page#62357
okxint wants to merge 1 commit into
nextcloud:masterfrom
okxint:fix/login-flow-grant-double-submit

Conversation

@okxint

@okxint okxint commented Jul 21, 2026

Copy link
Copy Markdown

Fixes #62327

The Vue rewrite of LoginFlowGrant dropped the disable-on-submit guard that existed in the old grant.js (added in #33164). Without it, Chrome's double-fire behavior or a fast second click sends two POST requests before the first response arrives, which can result in duplicate grant confirmations.

Fix: add an isSubmitting ref that blocks re-entry into onSubmit and disables the button while the request is in flight. A NcLoadingIcon is shown in the #icon slot during submission, following the same pattern used in PublicPageMenuExternalDialog.vue.

<!-- before -->
<NcButton type="submit" variant="primary">
    {{ t('core', 'Grant access') }}
</NcButton>

<!-- after -->
<NcButton :disabled="isSubmitting" type="submit" variant="primary">
    <template v-if="isSubmitting" #icon>
        <NcLoadingIcon />
    </template>
    {{ t('core', 'Grant access') }}
</NcButton>

Add isSubmitting guard to onSubmit so the button is disabled and shows
a loading spinner as soon as the first submit fires. A second click
while the form is in-flight is dropped via event.preventDefault().

Fixes: nextcloud#62327

Assisted-by: ClaudeCode:claude-sonnet-4-6
@okxint
okxint requested a review from a team as a code owner July 21, 2026 07:06
@okxint
okxint requested review from kristian-zendato, nfebe and sorbaugh and removed request for a team July 21, 2026 07:06
@CarlSchwan
CarlSchwan requested a review from susnux July 21, 2026 08:29
@CarlSchwan CarlSchwan added bug 3. to review Waiting for reviews community pull requests from community labels Jul 21, 2026
@CarlSchwan CarlSchwan added this to the Nextcloud 35 milestone Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug community pull requests from community

Projects

None yet

2 participants