Sign-in rules: tests that change their own password send the current one; field labels en/pl; the hook carries a mark

Tests and the late-staff built-site spec that change an account's OWN
password now send currentPassword (the 1.18.0 rule). The Current password
field's label and description are plain { en, pl } (house style checked by
the wording test). The beforeOperation hook carries SIGN_IN_RULES_MARK so
the password-rule hook counts stay what they measure. The injected users
collection carries Payload's lock defaults (50, 1 h).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 11:18:21 +01:00
co-authored by Claude Opus 5.5
parent 52710021ef
commit 420fe40442
8 changed files with 20 additions and 15 deletions
+2 -1
View File
@@ -77,7 +77,8 @@ describe('exempt from 2FA setup: by an admin-only field, not by e-mail', () => {
})
test('…while the same editor can change its own e-mail to anything: an e-mail list is no boundary', async () => {
const res = await call(`/users/${editorId}`, { body: JSON.stringify({ email: '[email protected]' }), method: 'PATCH' })
// (1.18.0: with its current password — accounts.confirmOwnChanges)
const res = await call(`/users/${editorId}`, { body: JSON.stringify({ currentPassword: PASSWORD, email: '[email protected]' }), method: 'PATCH' })
expect(res.status).toBe(200)
const stored = (await payload.findByID({ id: editorId, collection: 'users' as never, overrideAccess: true })) as unknown as { email: string }
expect(stored.email).toBe('[email protected]')