feat(auth): harden authentication and add configurable two-factor support
This commit is contained in:
@@ -40,8 +40,8 @@ describe('registerSchema', () => {
|
||||
first_name: 'Test',
|
||||
last_name: 'User',
|
||||
email: 'test@example.com',
|
||||
password: 'password123',
|
||||
password_confirmation: 'password123',
|
||||
password: 'correct horse battery staple',
|
||||
password_confirmation: 'correct horse battery staple',
|
||||
}
|
||||
|
||||
it('accepts valid registration data', () => {
|
||||
@@ -69,8 +69,8 @@ describe('registerSchema', () => {
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects password shorter than 8 characters', () => {
|
||||
const result = validate(registerSchema, { ...validData, password: 'short', password_confirmation: 'short' })
|
||||
it('rejects password shorter than 15 characters', () => {
|
||||
const result = validate(registerSchema, { ...validData, password: 'too-short', password_confirmation: 'too-short' })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
@@ -110,8 +110,8 @@ describe('forgotPasswordSchema', () => {
|
||||
describe('resetPasswordSchema', () => {
|
||||
const validData = {
|
||||
email: 'test@example.com',
|
||||
password: 'newpassword123',
|
||||
password_confirmation: 'newpassword123',
|
||||
password: 'a secure new password',
|
||||
password_confirmation: 'a secure new password',
|
||||
}
|
||||
|
||||
it('accepts valid reset data', () => {
|
||||
@@ -124,8 +124,8 @@ describe('resetPasswordSchema', () => {
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects password shorter than 8 characters', () => {
|
||||
const result = validate(resetPasswordSchema, { ...validData, password: 'short', password_confirmation: 'short' })
|
||||
it('rejects password shorter than 15 characters', () => {
|
||||
const result = validate(resetPasswordSchema, { ...validData, password: 'too-short', password_confirmation: 'too-short' })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user