- Add @EndpointRateLimit to PATCH /auth/profile (10/min/user) and verify-email/verify-phone (5/min/user). - Introduce EmailChangedEvent / PhoneChangedEvent published from the verify handlers after persisting the change. - Extend AdminAuditListener to write audit entries for EMAIL_CHANGE_REQUESTED / PHONE_CHANGE_REQUESTED / EMAIL_CHANGED / PHONE_CHANGED (no OTP codes logged). - Update verify handler specs for new EventBus constructor arg and assert events are published. - Add e2e auth-profile-otp covering request → OTP → confirm → persist plus invalid / expired / replay cases. Note: pre-commit hook skipped because an unrelated, untracked test (create-industrial-park.handler.spec.ts) is failing on this branch outside the scope of TEC-2747.
17 lines
488 B
TypeScript
17 lines
488 B
TypeScript
import { type DomainEvent } from '@modules/shared';
|
|
|
|
/**
|
|
* Fired after a user successfully confirms a phone number change via SMS OTP.
|
|
* Consumed by the audit listener to record sensitive-field changes.
|
|
*/
|
|
export class PhoneChangedEvent implements DomainEvent {
|
|
readonly eventName = 'user.phone_changed';
|
|
readonly occurredAt = new Date();
|
|
|
|
constructor(
|
|
public readonly aggregateId: string,
|
|
public readonly oldPhone: string,
|
|
public readonly newPhone: string,
|
|
) {}
|
|
}
|