public void Handle(AccountConfirmed @event)
 {
     using (var context = _contextFactory.Invoke())
     {
         var account = context.Find <AccountDetail>(@event.SourceId);
         account.IsConfirmed     = true;
         account.DisabledByAdmin = false;
         context.Save(account);
     }
 }
示例#2
0
        public async Task <bool> Confirm(string email, string securityStamp)
        {
            var identity = await _identityRepository.GetByEmail(email);

            if (identity?.IsEnabled == false && identity.SecurityStamp == securityStamp)
            {
                await _mediator.Publish(AccountConfirmed.From(identity));

                identity.IsEnabled = true;
                await _identityRepository.Update(identity);

                return(true);
            }

            return(false);
        }