Exemple #1
0
        private async Task OnTransactionComplete(
            User user,
            UpdateStatus updateStatus
            )
        {
            _userContextCache.Clear(user.UserId);

            if (updateStatus.RequiresSecurityStampUpdate())
            {
                await _userSecurityStampUpdateHelper.OnTransactionCompleteAsync(user);
            }

            if (updateStatus.HasActivationStatusChanged)
            {
                await _messageAggregator.PublishAsync(new UserActivationStatusUpdatedMessage()
                {
                    UserAreaCode = user.UserAreaCode,
                    UserId       = user.UserId,
                    IsActive     = !user.DeactivatedDate.HasValue
                });
            }

            if (updateStatus.HasVerificationStatusChanged)
            {
                await _messageAggregator.PublishAsync(new UserAccountVerificationStatusUpdatedMessage()
                {
                    UserAreaCode = user.UserAreaCode,
                    UserId       = user.UserId,
                    IsVerified   = user.AccountVerifiedDate.HasValue
                });
            }

            await _userUpdateCommandHelper.PublishUpdateMessagesAsync(user, updateStatus.UpdateEmailAndUsernameResult);
        }