Exemplo n.º 1
0
        public async Task Handle(UserPasswordResetRequested e, CancellationToken cancellationToken)
        {
            // generate random guid that maps back to aggregate id
            // store it in the storage
            // send email

            Console.WriteLine("Issuing password reset");

            var u = await _storage.GetUser(e.AggregateId);

            if (u == null)
            {
                return;
            }

            var association = new ProcessIdToUserAssociation(e.AggregateId, e.When);

            await _storage.SaveUserAssociation(association);

            var reseturl = $"{EmailSettings.PasswordResetUrl}/{association.Id}";

            await _email.Send(
                u.State.Email,
                Sender.NoReply,
                EmailTemplate.PasswordReset,
                new { reseturl }
                );
        }
Exemplo n.º 2
0
        private async Task SendConfirmAccountEmail(UserCreated e, User u)
        {
            var request = new ProcessIdToUserAssociation(e.AggregateId, e.When);

            await _storage.SaveUserAssociation(request);

            var confirmurl = $"{EmailSettings.ConfirmAccountUrl}/{request.Id}";

            await _email.Send(
                new Recipient(email : u.State.Email, name : u.State.Name),
                Sender.NoReply,
                EmailTemplate.ConfirmAccount,
                new { confirmurl }
                );
        }