0

在我的域中,我有两个有界上下文,一个包含员工,另一个 BC 是电子邮件通信器,我的员工只有在获得批准后才会获得密码,因此此时会向他们发布密码。

这个密码是加密的,所以我想用新的加密密码联系包含员工的 BC,但还要在另一个 BC 中向他们发送一封电子邮件,其中包含一封包含他们的用户名和密码的欢迎电子邮件。

我考虑过为此使用事件,发送一个事件来更新 Employee 实体,另一个发送电子邮件。

这是最好的方法还是有人知道更好的方法?

提前致谢

4

1 回答 1

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.

于 2019-01-24T17:29:38.353 回答