Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions __tests__/provider-connections.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ describe("ProviderConnections", () => {
expect(window.location.assign).not.toHaveBeenCalled();
});

it("static-token provider: the token field is plain text so browsers do not autofill a saved password", () => {
renderComponent();

fireEvent.click(screen.getByRole("button", { name: /^Connect Dataverse$/i }));

const tokenInput = screen.getByLabelText(/API token/i);
expect(tokenInput).toHaveAttribute("type", "text");
expect(tokenInput).toHaveAttribute("autocomplete", "off");
expect(tokenInput).toHaveAttribute("data-1p-ignore");
expect(tokenInput).toHaveAttribute("data-lpignore", "true");
});

it("static-token provider: Save posts token + serverUrl to connectstatictokenprovider", async () => {
global.fetch.mockResolvedValue({
ok: true,
Expand Down
15 changes: 14 additions & 1 deletion components/account/ProviderConnections.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,23 @@ export default function ProviderConnections({ data }) {
)}
<Field.Root>
<Field.Label>{provider.tokenLabel}</Field.Label>
{/* Plain text, not type="password": Chrome ignores
autocomplete="off" on password fields and fills in the
saved DataPipe login, so a paste lands after it (#278).
Masking buys little -- the token is shown in the clear on
the installation's own page -- and seeing it lets the
researcher check what they pasted. The data-* attributes
keep 1Password and LastPass from filling it too. */}
<Input
type="password"
type="text"
value={apiToken}
autoComplete="off"
autoCapitalize="off"
autoCorrect="off"
spellCheck={false}
data-1p-ignore
data-lpignore="true"
fontFamily="mono"
onChange={(e) => setApiToken(e.target.value)}
/>
{provider.tokenHelp && (
Expand Down
Loading