0

In my domain, I have two bounded contexts, one that contains a Employee and the other BC is an email communicator, my Employee is only given a password when they have been approved, and therefore there password is published to them at this point.

This password is encrypted so i want to contact the BC that contains the Employee with the new encrypted password, but also send them out an email in the other BC with a welcome email containing their username and password.

I've thought about using Events for this, sending one event off to update the Employee entity and another to send out the email.

Is this the best approach or does any one know of something better?

Thanks in advance

Matt
  • 2,713
  • 5
  • 27
  • 35

1 Answers1

0

Assuming the password is being changed by a POST request. * You will check if the current password is correct. * You will verify that the new password is valid and then encrypt it. * Will fire the PasswordWasChanged event * You will have the new password saved in an unencrypted variable, so just pass the new password to a service that will send the email to the user. (This service will be subscribed to listen to the PasswordWasChanged event but you will not need to use it.)

Comments: * It is not advisable to send the password by e-mail; * No way to save the decrypted password in the event.