M1 (7): a password rule for staff accounts (accounts.password)
When a password is set on a staff collection — a new account, the first-user
screen, a change, a reset by e-mail; panel, API and Local API alike — it must
have at least 12 characters and not be the account's own e-mail address.
Existing passwords are never checked: a shorter one keeps logging in and meets
the rule when it is next changed. accounts.password: { minLength } | false.
No breached-password lookup; checkPassword and the hook are exported.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
c6fc0d21fe
commit
5d35b2c3f4
@@ -167,7 +167,7 @@ describe('forms against a real Payload', () => {
|
||||
test('open sign-up cannot self-assign admin — roles fall back to the default', async () => {
|
||||
const user = (await payload.create({
|
||||
collection: 'users',
|
||||
data: { email: '[email protected]', password: 'Passw0rd!x', roles: ['admin'] } as never,
|
||||
data: { email: '[email protected]', password: 'Passw0rd!x-long', roles: ['admin'] } as never,
|
||||
overrideAccess: false,
|
||||
})) as unknown as { roles: string[] }
|
||||
expect(user.roles).toEqual(['user'])
|
||||
@@ -176,7 +176,7 @@ describe('forms against a real Payload', () => {
|
||||
test('seed / Local API with overrideAccess can still create an admin', async () => {
|
||||
const admin = (await payload.create({
|
||||
collection: 'users',
|
||||
data: { email: '[email protected]', password: 'Passw0rd!x', roles: ['admin'] } as never,
|
||||
data: { email: '[email protected]', password: 'Passw0rd!x-long', roles: ['admin'] } as never,
|
||||
})) as unknown as { roles: string[] }
|
||||
expect(admin.roles).toEqual(['admin'])
|
||||
})
|
||||
@@ -401,7 +401,7 @@ describe('forms access', () => {
|
||||
|
||||
const user = (await payload.create({
|
||||
collection: 'users',
|
||||
data: { email: '[email protected]', password: 'Passw0rd!x' } as never,
|
||||
data: { email: '[email protected]', password: 'Passw0rd!x-long' } as never,
|
||||
})) as unknown as Record<string, unknown>
|
||||
await expect(
|
||||
payload.find({ collection: 'form-submissions' as never, overrideAccess: false, user: { ...user, collection: 'users' } as never }),
|
||||
|
||||
Reference in New Issue
Block a user