mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 23:00:59 -05:00
* fix(cognito): fire the CustomMessage trigger for UpdateUserAttributes and GetUserAttributeVerificationCode Both sent their verification codes without the CustomMessage trigger, so a pool's function never shaped those messages and never saw the request's ClientMetadata. They now fire it with CustomMessage_UpdateUserAttribute and CustomMessage_VerifyUserAttribute. Measured on Cognito, the event carries the user as stored once the request is done: the whole update applied, and an email that must be verified before it changes still the old one while the code goes to the new address. The message is therefore sent once the update is stored and the user lock is released. The trigger is synchronous, so holding the lock would also block a function that calls the pool back for the same user until its invocation timed out, which SignUp already avoids. Cognito keeps an update whose code it cannot deliver and answers CodeDeliveryFailureException, and a message that cannot be sent now does the same. * fix(cognito): leave nothing behind when an attribute code's message is not sent Sending an attribute code's message after the user lock opened four ways to leave a code live that no message carried, or to fail an update already stored. Each message is now sent on its own: one that cannot be sent has its code withdrawn, so another can be asked for at once as on Cognito, and the others still go out. An update that stops before it is stored withdraws the codes it already issued. The pool, the client and a copy of the stored user are read while the lock is held, as SignUp captures its trigger's user, so nothing is looked up once the update is stored.