Take the standard registration process:
user signs up
user is sent email with link activate account
user activates account
the issue i'm talking about is:
when we create the initial account we store the username, password, email, activation key
when the user clicks the activation key link we validate the key using the readmodel
we then fire the ActivateAccountCommand passing in the username
how do i load the users account to activate it in the domain?
initially I wanted to pass the new users Acount.Id to the readmodel but there is no access (that i'm aware of) from within the CommandExecutorBase - we don't save this:
protected override void ExecuteInContext(IUnitOfWorkContext context,
CreateAccountViaFormRegistrationCommand command)
{
var newKey = Guid.NewGuid().ToString();
var newAccount = new Account(
command.UserName, command.Email, command.Password, newKey);
SendWelcomeEmail(command.Email, command.UserName, newKey);
context.Accept();
}
You can publish an
AccountActivationKeySent
event, which in turn can be handled to populate whatever projection you need on the read side. Something along the lines of: