diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-07-08 00:54:44 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-07-08 01:01:42 -0400 |
| commit | dbc9d7fd264ed68419286d4edfc3b98ca5a2dbe0 (patch) | |
| tree | 086e593a0c3c1e91486b4df43785de3b18d7adcf | |
| parent | c35be3ae29e77983f013c01260dda20208175f2b (diff) | |
Bug: the login form generates incorrect requests (once per pageview).
Steps to reproduce:
**Note**: You will need to watch the traffic in a DOM inspector; this has no user-observable symptoms because there's presently no error reporting for the login form.
1. In a new private tab, visit the `/login` page of a Pilcrow instance.
2. **Without touching the username or password fields**, click `sign in`.
The client _should_ send a request to `/api/auth/login` with the following payload:
```json
{
"name": "",
"password": ""
}
```
However, it instead sends an empty payload, leading to a 422 Unprocessable Content response as the request is missing required fields. Subsequent requests, or any request after the user enters data in the input fields, are correctly serialized.
| -rw-r--r-- | ui/tests/lib/components/LogIn.svelte.test.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/tests/lib/components/LogIn.svelte.test.js b/ui/tests/lib/components/LogIn.svelte.test.js index 00abb5c..0835870 100644 --- a/ui/tests/lib/components/LogIn.svelte.test.js +++ b/ui/tests/lib/components/LogIn.svelte.test.js @@ -31,4 +31,11 @@ describe('LogIn', async () => { 'my very creative and long password', ); }); + + it('sends empty strings before being populated', async () => { + const signIn = screen.getByRole('button'); + await user.click(signIn); + + expect(mocks.logIn).toHaveBeenCalledExactlyOnceWith('', ''); + }); }); |
