Repository navigation
Conversation
Add user-owned expiring and revocable credentials, strict Bearer authentication, semantic route scopes, current account resolution, recent-authentication checks, account lifecycle hooks, and default-off admin controls. Include account-settings management, HTTP documentation, and end-to-end coverage for two eligible users creating content and voting through PATs.
|
The PAT lookup selects an external login by For example, a local account linked only to GitHub is correctly exempt from UserCenter status checks during password login, but its PAT sends the GitHub ID to UserCenter, which may produce an incorrect authentication result. Please align this with |
Filter external login lookup by both user ID and the active UserCenter provider. Leave ExternalID empty when no UserCenter or matching binding exists, so unrelated OAuth identities are never sent to the plugin. Add regression coverage for disabled UserCenter, missing bindings, unrelated and inactive providers, matching bindings, and multiple providers, including another user's binding. Addresses the review comment on apache#1686.
|
Fixed in 138b297. |
|
@robinv8 There are no issues on the backend. Please check if there are any changes that need to be made to the front end. |
robinv8
left a comment
There was a problem hiding this comment.
Thanks for the PR. I’m requesting changes for the password form, duplicate submissions, and revocation while token access is disabled. I’ve left the details inline.
| old_pass: formData.old_pass.value, | ||
| pass: formData.pass.value, | ||
| revoke_personal_access_tokens: | ||
| formData.revoke_personal_access_tokens.value, |
There was a problem hiding this comment.
Blocking: Reset the revoke-all option when closing the password form
This submits the checkbox value from the previous form session. If a user checks “Revoke all personal access tokens,” cancels, and reopens the form, the box is still checked. Saving a new password can then revoke every token unintentionally. Please clear the form on cancel and after a successful save, and add a regression test that checks the next submission sends false.
There was a problem hiding this comment.
Fixed in 20dbcc7: the password form now resets via initialFormData()/closeForm() on both cancel and successful save, so revoke_personal_access_tokens (and the rest of the form) no longer carries over between sessions. Added regression coverage in ModifyPass/index.test.tsx for both the cancel and save paths.
| <Button variant="link" onClick={resetCreate}> | ||
| {t('cancel', { keyPrefix: 'btns' })} | ||
| </Button> | ||
| <Button disabled={!canCreate} onClick={createToken}> |
There was a problem hiding this comment.
Blocking: Prevent duplicate token creation
This button remains enabled while creation is pending. Two clicks can create two tokens, and a later response can replace the first token in the one-time display. The Continue button in the reauthentication dialog has the same issue. Please guard both handlers against duplicate calls and disable the buttons while their requests are pending. Keep the reauthentication flow guarded until the subsequent token creation request finishes. Please also clear the password and pending create data when dismissing the reauthentication dialog.
There was a problem hiding this comment.
Fixed in 20dbcc7: createToken/confirmReauthentication are now guarded by a submitting ref + isSubmitting state, with the Create/Continue buttons disabled while a request is in flight. The reauthentication flow stays guarded through the follow-up creation call, and dismissCreate/dismissReauthentication clear the password and pending create payload when either dialog is dismissed. Added tests covering double-click guarding and dialog dismissal.
| </Badge> | ||
| </td> | ||
| <td className="text-end"> | ||
| {item.status === 'active' && ( |
There was a problem hiding this comment.
Blocking: Keep revocation available when token access is disabled
The disabled banner says users can still revoke existing tokens, but the API marks them temporarily_unavailable. Those rows are hidden by default and have no Revoke action even when shown. Please make them visible and revocable without requiring the administrator to turn token access back on.
There was a problem hiding this comment.
Fixed in 20dbcc7: added isRevocable() (active or temporarily_unavailable) so those tokens stay visible by default and keep their Revoke action even while PAT access is disabled site-wide. Covered by a new regression test.
| const security = siteSecurityStore(); | ||
| const user = loggedUserInfoStore((state) => state.user); | ||
| const reauthenticationCaptcha = useCaptchaPlugin('edit_userinfo'); | ||
| const { data = [], mutate } = usePersonalAccessTokens(); |
There was a problem hiding this comment.
Non-blocking: Distinguish a failed fetch from an empty list
Defaulting data to an empty array makes a failed request, such as a timeout, look like the user has no tokens. The hook already exposes isLoading and error. Please use them to show loading and a retryable error, and reserve the empty state for a successful response.
There was a problem hiding this comment.
Fixed in 20dbcc7: the component now reads isLoading/error from usePersonalAccessTokens and renders a loading state, a retryable error alert, or the empty-list message accordingly, instead of defaulting data to []. Added a test asserting all three states render distinctly.
| ), | ||
| ).toBe(true); | ||
| const createButtons = screen.getAllByRole('button', { name: 'create' }); | ||
| expect(createButtons[createButtons.length - 1].hasAttribute('disabled')).toBe( |
There was a problem hiding this comment.
Test coverage: Isolate the scope requirement
The name is blank here, so Create would still be disabled if the scope check were removed. Please enter a valid name first, verify that Create is disabled with no scopes, then select one scope and verify it becomes enabled.
There was a problem hiding this comment.
Fixed in 20dbcc7: the test now fills in a valid name before toggling scopes, so the Create button's disabled state is isolated to the scope requirement rather than also being gated by an empty name.
Reset the password form after cancellation and successful updates. Guard PAT creation and reauthentication through the subsequent creation request, and discard passwords and pending payloads when the dialog is dismissed. Keep temporarily unavailable tokens visible and revocable while PAT access is disabled. Distinguish loading and retryable fetch errors from successful empty results. Add regression coverage and isolate the explicit-scope requirement, addressing robinv8's review on apache#1686.
Fixes #1555
Proposed Changes