public void Handle(IUserSession userIssuingCommand, CreatePasswordResetToken command)
        {
            var  user    = _readOnlyRepository.First <UserEmailLogin>(x => x.Email == command.Email);
            Guid tokenId = _idGenerator.Generate();

            _writeableRepository.Create(new PasswordResetAuthorization(tokenId, user.Id, _timeProvider.Now()));
            NotifyObservers(new PasswordResetTokenCreated(tokenId, user.Id));
        }
        public UserLoginSession Create(User executor)
        {
            DateTime dateTime = _tokenExpirationProvider.GetExpiration(_timeProvider.Now());
            Guid     token    = _identityGenerator.Generate();

            var userSession = new UserLoginSession(token, executor, dateTime);

            _writeableRepository.Create(userSession);

            return(userSession);
        }
        public void Handle(IUserSession userIssuingCommand, CreateEmailLoginUser command)
        {
            var userCreated = new UserEmailLogin(command.Name, command.Email, command.EncryptedPassword,
                                                 command.PhoneNumber);

            command.abilities.ToList().ForEach(x => userCreated.AddAbility(_readOnlyRepository.GetById <UserAbility>(x.Id)));

            var userSaved = _writeableRepository.Create(userCreated);

            NotifyObservers(new UserEmailCreated(userSaved.Id, command.Email, command.Name, command.PhoneNumber));
        }
        public UserSession Create(User executor)
        {
            var userSession = new UserSession
            {
                Id      = _tokenGenerator.Generate(),
                User    = executor,
                Expires = _tokenExpirationProvider.GetExpiration(_timeProvider.Now())
            };

            _writeableRepository.Create(userSession);

            return(userSession);
        }
 public void Handle(IUserSession userIssuingCommand, CreateEmailLoginUser command)
 {
     _writeableRepository.Create(new UserEmailLogin(command.Name, command.Email, command.EncryptedPassword, command.PhoneNumber));
     NotifyObservers(new UserCreated(command.Email, command.Name, command.PhoneNumber));
 }
        public void Handle(IUserSession userIssuingCommand, CreateFacebookLoginUser command)
        {
            var userCreated = _writeableRepository.Create(new UserFacebookLogin(command.name, command.email, command.id, command.firstName, command.lastName, command.imageUrl, command.link));

            NotifyObservers(new UserFacebookCreated(userCreated.Id, command.email, command.name, command.id));
        }
Beispiel #7
0
        public void Handle(IUserSession userIssuingCommand, CreateGoogleLoginUser command)
        {
            var userCreated = _writeableRepository.Create(new UserGoogleLogin(command.DisplayName, command.Email, command.Id, command.GivenName, command.FamilyName, command.ImageUrl, command.Url));

            NotifyObservers(new UserGoogleCreated(userCreated.Id, command.Email, command.DisplayName, command.Id));
        }