Exemplo n.º 1
0
 public AccountController([FromServices] IPasswordService passwordService,
                          [FromServices] IAccountService accountService, IMapper mapper)
 {
     _accountService  = accountService;
     _passwordService = passwordService;
     _mapper          = mapper;
 }
 public CustomCredentialsAuthProvider(ICommandBus commandBus, IAccountDao dao, IPasswordService passwordService, IServerSettings serverSettings)
 {
     _passwordService = passwordService;
     _commandBus      = commandBus;
     _serverSettings  = serverSettings;
     Dao = dao;
 }
 public UserService(
     ApplicationDbContext db,
     IPasswordService passwordService)
 {
     this.db = db;
     this.passwordService = passwordService;
 }
 public PasswordHandler(
     IUserRepository userRepository,
     IPasswordService passwordService)
 {
     _userRepository  = userRepository;
     _passwordService = passwordService;
 }
 public AuthenticationService(ApplicationContext context, IConfiguration configuration,
                              IPasswordService passwordService)
 {
     _context         = context;
     _configuration   = configuration;
     _passwordService = passwordService;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AccountController"/> class.
        /// </summary>
        /// <param name="logger">Logger Service</param>
        /// <param name="loginService">Login Service</param>
        /// <param name="userService">User Service</param>
        /// <param name="passwordService">Password Service</param>
        public AccountController(
            ILoggerService logger, 
            ILoginService loginService, 
            IUserService userService, 
            IPasswordService passwordService)
            : base(logger)
        {
            if (loginService == null)
            {
                throw new ArgumentNullException("ILoginService, LoginController");
            }

            if (userService == null)
            {
                throw new ArgumentNullException("IUserService, LoginController");
            }

            if(passwordService == null)
            {
                throw new ArgumentNullException("IPasswordService, LoginController");
            }

            this._loginService = loginService;
            this._userService = userService;
            this._passwordService = passwordService;
        }
Exemplo n.º 7
0
 public SetNewPasswordCommandHandler(IHandler handler,
                                     IMediatRBus mediatRBus, IPasswordService passwordService)
 {
     _handler         = handler.CheckIfNotEmpty();
     _mediatRBus      = mediatRBus.CheckIfNotEmpty();
     _passwordService = passwordService.CheckIfNotEmpty();
 }
Exemplo n.º 8
0
 public TokenController(IConfiguration configuration, IPasswordService passwordService, INetCoreUserService <NetCoreUser> userService, IMapper mapper, ILogger <BaseController> logger)
     : base(mapper, logger)
 {
     _configuration   = configuration;
     _passwordService = passwordService;
     _userService     = userService;
 }
Exemplo n.º 9
0
        public AjaxController()
        {
            var messageRepository = new MessageRepository();
            var permissionRepository = new PermissionRepository();
            var churchRepository = new ChurchRepository();
            var personRepository = new PersonRepository(permissionRepository, churchRepository);
            var uploadPhotoRepository = new PhotoRepository();
            _familyRepository = new FamilyRepository(uploadPhotoRepository);
            _usernamePasswordRepository = new UsernamePasswordRepository(permissionRepository);
            var personGroupRepository = new PersonGroupRepository(personRepository);
            _personGroupRepository = personGroupRepository;
            var groupRepository = new GroupRepository();
            var emailSender = new EmailSender(messageRepository, new MessageRecepientRepository(), new MessageAttachmentRepository(), personRepository);
            var emailContentService = new EmailContentService(new EmailContentRepository());
            var churchEmailTemplateRepository = new ChurchEmailTemplatesRepository();
            _emailService = new EmailService(
                _usernamePasswordRepository,
                personRepository,
                groupRepository,
                emailSender,
                emailContentService,
                churchEmailTemplateRepository,
                permissionRepository
                );

            _passwordService = new PasswordService(personRepository, churchRepository, _usernamePasswordRepository, _emailService);

            _personService = new PersonService(
                personRepository,
                _personGroupRepository,
                permissionRepository,
                new PersonRoleRepository(),
                new PersonOptionalFieldRepository(),
                new RelationshipRepository(personRepository),
                new ChurchMatcherRepository(),
                groupRepository,
                _familyRepository,
                _emailService,
                new AddressRepository(),
                uploadPhotoRepository
                );

            _groupEventRepository = new GroupEventRepository(personRepository);
            _systemAdministratorService  = new SystemAdministratorService(churchRepository, permissionRepository);
            _personGroupService = new PersonGroupService(_personGroupRepository);
            _messageRecepientRepository = new MessageRecepientRepository();
            var httpPostService = new HttpPostService();
            _smsSender = new SmsSender(messageRepository, new MessageRecepientRepository(), personRepository, httpPostService);
            _churchEventsReporitory = new ChurchEventsRepository();
            _messageService = new MessageService(_messageRecepientRepository);
            var birthdayRepository = new BirthdayAndAniversaryRepository();
            var usernamePasswordRepository = new UsernamePasswordRepository(permissionRepository);
            var churchEmailTemplatesRepository = new ChurchEmailTemplatesRepository();
            var emailService = new EmailService(usernamePasswordRepository, personRepository, groupRepository, emailSender, emailContentService, churchEmailTemplatesRepository, permissionRepository);
            var eventRepository = new EventRepository(birthdayRepository);
            _eventService = new EventService(eventRepository, emailService, birthdayRepository);
            _childReportsService = new ChildReportsService(new ChildrenReportsRepository(), _emailService);
            _reminderService = new ReminderService(new ReminderRepository());
        }
 public EFMembershipService()
 {
     // set up dependencies
     _createDatabaseContext = ()=>new BonoboGitServerContext();
     Action<string, string> updateUserPasswordHook =
         (username, password)=>UpdateUser(username, null, null, null, password);
     _passwordService = new PasswordService(updateUserPasswordHook);
 }
Exemplo n.º 11
0
        public UserSerivce(IConfiguration configuration, IUserRepository userRepositor, IMapper mapper, IPasswordService passwordService)
        {
            _mapper         = mapper;
            _config         = configuration;
            _userRepository = userRepositor;

            _passwordService = passwordService;
        }
Exemplo n.º 12
0
 public EmailsController(IUserService userService,
     IPasswordService passwordService,
     IAuthenticationService authenticationService)
 {
     _userService = userService;
     _passwordService = passwordService;
     _authenticationService = authenticationService;
 }
Exemplo n.º 13
0
 public UserMongoDBRepository(IMongoIdentityContext context,
                              ILogger <UserMongoDBRepository> logger,
                              IPasswordService passwordService)
 {
     _context         = context;
     _logger          = logger;
     _passwordService = passwordService;
 }
Exemplo n.º 14
0
 public EditUserInfoViewModel()
 {
     RegisterMessages();
     _userPhoneNumbers = new ObservableCollection <string>();
     _userAddresses    = new ObservableCollection <UserAddress>();
     _userService      = ServiceLocator.Instance.UserService;
     _passwordService  = ServiceLocator.Instance.PasswordService;
 }
Exemplo n.º 15
0
 public IdentityService(IUserRepository userRepository, IPasswordService passwordService,
                        IJwtProvider jwtProvider, IMessageBroker messageBroker)
 {
     _userRepository  = userRepository;
     _passwordService = passwordService;
     _jwtProvider     = jwtProvider;
     _messageBroker   = messageBroker;
 }
 public ChangePasswordHandler(IHandler handler,
                              IBusClient bus,
                              IPasswordService passwordService)
 {
     _handler         = handler;
     _bus             = bus;
     _passwordService = passwordService;
 }
Exemplo n.º 17
0
 public CredentialsUserService(IUnitOfWork unitOfWork, IMapper mapper, IPasswordService passwordService, /*IEncriptador qphEncriptador,*/ SieveProcessor sieveProcessor)
 {
     _unitOfWork      = unitOfWork;
     _mapper          = mapper;
     _passwordService = passwordService;
     //_qphEncriptador = qphEncriptador;
     _sieveProcessor = sieveProcessor;
 }
Exemplo n.º 18
0
 public AdminService(IUnitOfWork unitOfWork, ICacheStore cacheStore, IPasswordService hasher,
                     IIdentityProvider identityProvider)
 {
     _unitOfWork       = unitOfWork;
     _cacheStore       = cacheStore;
     _hasher           = hasher;
     _identityProvider = identityProvider;
 }
Exemplo n.º 19
0
        public ApiV1UserController(IPasswordService passwordService, IUserService userService, ILoginService loginService, ILogger <ApiV1UserController> logger)
        {
            this.passwordService = passwordService;
            this.userService     = userService;
            this.loginService    = loginService;

            this.logger = logger;
        }
Exemplo n.º 20
0
 public UsersController(IRepository <Usuario> Repository,
                        IMapper mapper,
                        ISecurityService securityService,
                        IPasswordService passwordService, IAuthorizationService authorizationService) : base(Repository, mapper, authorizationService)
 {
     _securityService = securityService;
     _passwordService = passwordService;
 }
Exemplo n.º 21
0
 public GetChangePasswordAction(IPasswordService passwordService,
                                IUserService <User> userService,
                                ISecurityContext securityContext)
 {
     _passwordService = passwordService;
     _userService     = userService;
     _securityContext = securityContext;
 }
Exemplo n.º 22
0
 public UserService(IRepository repository,
                    IPasswordService passwordService,
                    IRoleService roleService)
 {
     Repository      = repository;
     PasswordService = passwordService;
     RoleService     = roleService;
 }
Exemplo n.º 23
0
 public AccountServiceTests()
 {
     context      = FakeContext.Context();
     config       = new FakeConfig();
     emailService = new EmailService();
     passServ     = new PasswordService(config);
     accServ      = new AccountService(context, passServ, emailService, config);
 }
Exemplo n.º 24
0
 public UserServiceImpl(IUserRepository userRepository,
                        IPasswordService passwordService,
                        IOptions <JwtSettings> jwtSettingsAccessor)
 {
     this.UserRepository  = userRepository;
     this.JwtSettings     = jwtSettingsAccessor.Value;
     this.PasswordService = passwordService;
 }
Exemplo n.º 25
0
 public UserService(IUserRepository userRepository, IPasswordService passwordService, IJwtService jwtService, IMapper mapper, IDateTime dateTime)
 {
     _userRepository  = userRepository;
     _passwordService = passwordService;
     _jwtService      = jwtService;
     _mapper          = mapper;
     _dateTime        = dateTime;
 }
        public TestimonialsService(ICryptoService cryptoService, IPasswordService passwordService, DatabaseContext databaseContext)
        {
            _cryptoService   = cryptoService;
            _passwordService = passwordService;
            _databaseContext = databaseContext;

            _adminPasswordHash = "WbjE3DyJpgjFZFucas8KmmdVq8xhjookF/fvk+NTmpM=rUKBQg1U8RdqXWJPAE0WkqmCRI4Qe/k71MFTkQRth/s=4wcAAA==";
        }
 public void SetUp()
 {
     userService             = A.Fake <IUserService>();
     passwordService         = A.Fake <IPasswordService>();
     authenticatedController = new ChangePasswordController(passwordService, userService)
                               .WithDefaultContext()
                               .WithMockUser(true, adminId: LoggedInAdminId, delegateId: LoggedInDelegateId);
 }
Exemplo n.º 28
0
 public CreateUserHandler(IUserRepository userRepository, IPasswordService passwordService,
                          IMessageBroker messageBroker, ILogger <CreateUserHandler> logger)
 {
     _userRepository  = userRepository;
     _passwordService = passwordService;
     _messageBroker   = messageBroker;
     _logger          = logger;
 }
Exemplo n.º 29
0
 public ResetPasswordController(IPasswordService passwordService, INotificationService notificationService, HeyImInConfiguration configuration, GetDatabaseContext getDatabaseContext, ILogger <ResetPasswordController> logger)
 {
     _passwordService         = passwordService;
     _notificationService     = notificationService;
     _resetTokenValidTimeSpan = configuration.TimeSpans.PasswordResetTimeout;
     _getDatabaseContext      = getDatabaseContext;
     _logger = logger;
 }
Exemplo n.º 30
0
 public LoginViewModel(INavigationService navigationService, IPasswordService passwordService, IInteractionService interactionService, IFolderRepository folderRepository, ILoginService loginService)
 {
     _navigationService  = navigationService;
     _passwordService    = passwordService;
     _interactionService = interactionService;
     _folderRepository   = folderRepository;
     _loginService       = loginService;
 }
Exemplo n.º 31
0
        public ChangePasswordHandler(IDataWriter dataWriter, IPasswordService passwordService)
        {
            Preconditions.CheckNotNull(dataWriter, "dataWriter");
            Preconditions.CheckNotNull(passwordService, "passwordService");

            this.dataWriter      = dataWriter;
            this.passwordService = passwordService;
        }
 public PasswordController(IPasswordService passwordService, IJwtService jwtService,
                           IValidator <PasswordAddDto> passwordAddDtoValidator, IValidator <PasswordEditDto> passwordEditDtoValidator)
 {
     _passwordService          = passwordService;
     _jwtService               = jwtService;
     _passwordAddDtoValidator  = passwordAddDtoValidator;
     _passwordEditDtoValidator = passwordEditDtoValidator;
 }
Exemplo n.º 33
0
 public WelcomeViewModel(INavigationService navigationService, IPasswordService passwordService, IInteractionService interactionService, IFolderRepository folderRepository, ILoginService loginService)
     : base(interactionService, passwordService, folderRepository, loginService)
 {
     _navigationService  = navigationService;
     _passwordService    = passwordService;
     _interactionService = interactionService;
     _loginService       = loginService;
 }
Exemplo n.º 34
0
 public SecurityController(ISecurityService service,
                           IMapper mapper,
                           IPasswordService passwordService)
 {
     _service         = service;
     _mapper          = mapper;
     _passwordService = passwordService;
 }
Exemplo n.º 35
0
 public AuthenticationService(
     IPasswordService passwordService,
     IAuthCookieService formsAuthenticationCookieDataProvider,
     IGetUserByUsernameQuery getUserByUsernameQuery)
 {
     _passwordService = passwordService;
     _formsAuthenticationCookieDataProvider = formsAuthenticationCookieDataProvider;
     _getUserByUsernameQuery = getUserByUsernameQuery;
 }
Exemplo n.º 36
0
 public RolesInitializer(
     IUserRepository userRepository,
     IPasswordService passwordService,
     IPortalMiddleendSettings settings)
 {
     _userRepository = userRepository;
     _passwordService = passwordService;
     _settings = settings;
 }
Exemplo n.º 37
0
        /// <summary> 检查密码是否可以用于登录。 </summary>
        public static PasswordMatchResult LogOnCheck(IPasswordService passwordService, IAccount account, string password)
        {
            if (account == null) throw new ArgumentNullException("account");

            if (account.PasswordFormat == PasswordFormats.NoPassword)
            {
                return new PasswordMatchResult(false, "The account has no local password set.", account);
            }
            return Check(passwordService, account, password);
        }
Exemplo n.º 38
0
        /// <summary> 检查密码是否匹配. </summary>
        /// <returns> 如匹配则返回 <c>true</c>, 否则返回 <c>false</c>. </returns>
        public static PasswordMatchResult Check(IPasswordService passwordService, IAccount account, string password)
        {
            if (account == null) throw new ArgumentNullException("account");

            bool isVerified = passwordService.Verify(account,  password);
            if (isVerified == false)
            {
                var message = String.Format("The password mismatch for user [{0}]([{1}]).", account.Id, account.Name);
                return new PasswordMatchResult(false, message, account);
            }
            return new PasswordMatchResult(true, null, account);
        }
        public UserAdministrationController(
			IMembershipSettings membershipSettings,
			IUserService userService,
			IPasswordService passwordService,
			IRolesService rolesService,
			ISmtpClient smtpClient)
        {
            _membershipSettings = membershipSettings;
            _userService = userService;
            _passwordService = passwordService;
            _rolesService = rolesService;
            _smtpClient = smtpClient;
        }
Exemplo n.º 40
0
 public AdminUserService(
     IRepositoryFactory repositoryFactory,
     IUserRepository userRepository,
     IProjectRepository projectRepository,
     IPasswordService passwordService,
     IProjectService projectService,
     IProductWriterForAdmin productWriterForAdmin,
     IMapper mapper)
 {
     _userRepository = userRepository;
     _passwordService = passwordService;
     _projectService = projectService;
     _productWriterForAdmin = productWriterForAdmin;
     _mapper = mapper;
     _fileRepository = repositoryFactory.Create<FileEntity>();
     _projectRepository = projectRepository;
 }
Exemplo n.º 41
0
 public PasswordRecoveryService(
     IRepositoryFactory repositoryFactory,
     IUserRepository userRepository,
     IMailerRepository mailerRepository,
     IPasswordRecoveryFactory passwordRecoveryFactory,
     IPortalFrontendSettings settings,
     IRecoveryLinkService recoveryLinkService,
     IPasswordService passwordService)
 {
     _userRepository = userRepository;
     _passwordRecoveryFactory = passwordRecoveryFactory;
     _settings = settings;
     _recoveryLinkService = recoveryLinkService;
     _passwordService = passwordService;
     _mailerRepository = mailerRepository;
     _passwordRecoverRepository = repositoryFactory.Create<PasswordRecoveryEntity>();
 }
Exemplo n.º 42
0
 public ProfileController(
     IUserService userService,
     IAuthenticationService authenticationService,
     IEmailNotificationService emailNotificationService,
     IPasswordService passwordService,
     IProductIdExtractor productIdExtractor,
     IUserAvatarProvider avatarProvider,
     IMapper mapper)
 {
     _userService = userService;
     _authenticationService = authenticationService;
     _emailNotificationService = emailNotificationService;
     _passwordService = passwordService;
     _productIdExtractor = productIdExtractor;
     _avatarProvider = avatarProvider;
     _mapper = mapper;
 }
 public EFMembershipService()
 {
     // set up dependencies
     Action<string, string> updateUserPasswordHook =
         (username, password) =>
         {
             using (var db = CreateContext())
             {
                 var user = db.Users.FirstOrDefault(i => i.Username == username);
                 if (user != null)
                 {
                     UpdateUser(user.Id, null, null, null, null, password);
                 }
             }
         };
     _passwordService = new PasswordService(updateUserPasswordHook);
 }
Exemplo n.º 44
0
        public LoginModule(IPasswordService passwordService)
        {
            Before += context =>
                {
                    var db = Database.Open();

                    if (db.Users.GetCount() == 0)
                    {
                        return Response.AsRedirect("~/admin/setup");
                    }

                    return null;
                };

            Get["/admin/login"] = parameters => View["Index.cshtml", new LoginViewModel()];

            Post["/admin/login"] = parameters =>
                {
                    string login = Request.Form.Login;
                    string password = Request.Form.Password;

                    var db = Database.Open();
                    var user = db.Users.FindAllByLogin(login).FirstOrDefault();

                    if (user == null)
                    {
                        return View["Index.cshtml", new LoginViewModel { Login = login, HasError = true }];
                    }

                    string salt = user.Salt;
                    string correctPassword = user.HashedPassword;

                    if (!passwordService.VerifyHashedPassword(password, salt, correctPassword))
                    {
                        return View["Index.cshtml", new LoginViewModel { Login = login, HasError = true }];
                    }

                    var guid = new Guid(user.Guid);

                    return this.LoginAndRedirect(guid, DateTime.Now.AddDays(7), "~/admin/posts");
                };
        }
Exemplo n.º 45
0
 public AccountController(
     IAuthenticationService authenticationService,
     IUserService userService,
     IEmailNotificationService emailNotificationService,
     IPortalFrontendSettings settings,
     ITokenDataExtractorFactory tokenDataExtractorFactory,
     ISocialNetworkNotificationFactory notificationFactory,
     IProductIdExtractor productIdExtractor,
     IPendingClientService pendingClientService,
     IPasswordService passwordService,
     ICompanyService companyService)
     : base(settings)
 {
     _emailNotificationService = emailNotificationService;
     _tokenDataExtractorFactory = tokenDataExtractorFactory;
     _notificationFactory = notificationFactory;
     _productIdExtractor = productIdExtractor;
     _pendingClientService = pendingClientService;
     _passwordService = passwordService;
     _companyService = companyService;
     _authenticationService = authenticationService;
     _userService = userService;
 }
Exemplo n.º 46
0
        public SetupModule(IPasswordService passwordService)
        {
            Before += context =>
                {
                    var db = Database.Open();

                    if (db.Users.GetCount() > 0)
                    {
                        return Response.AsRedirect("~/admin/login");
                    }

                    return null;
                };

            Get["/admin/setup"] = parameters => View["Index.cshtml", new SetupViewModel()];

            Post["/admin/setup"] = parameters =>
                {
                    var model = this.Bind<SetupViewModel>();
                    model.Validate();

                    if (model.HasError)
                    {
                        return View["Index.cshtml", model];
                    }

                    string salt = passwordService.GenerateSalt();
                    string hashedPassword = passwordService.HashPassword(model.Password, salt);
                    string guid = Guid.NewGuid().ToString();

                    var db = Database.Open();
                    db.Users.Insert(Login: model.Login, HashedPassword: hashedPassword, Salt: salt, Guid: guid);

                    return View["Done.cshtml"];
                };
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="passwordService"></param>
        /// <returns></returns>
        public string GetNewPasswordPassword(IPasswordService passwordService)
        {
            bool validPassword = false;
            string password = "";

            while (!validPassword)
            {
                //generate random password
                var PasswordService = passwordService;

                password = PasswordService.GenerateRandomPassword(8);
                // verify against password regex
                string regex = @"(?=^.{8,30}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&amp;*()_+}{&quot;&quot;:;'?/&gt;.&lt;,]).*$";
                Match match = Regex.Match(password, regex);
                if (match.Success)
                    validPassword = true;
            }

            return password;
        }
Exemplo n.º 48
0
        public UserModule(IUserService userService, IErrorService error, IPasswordService passwordService, IUserCacheService userCacheService)
            : base("/user")
        {
            Post["/create"] = _ =>
            {
                if (Params.AreMissing("UserName", "Email")) return error.MissingParameters(Response);
                if (userService.GetUserByName(Params.UserName)!=null) return error.UserNameTaken(Response);
                if (!Params.Email.IsEmail()) return error.InvalidParameters(Response);
                var password = userService.CreateUser(Params.UserName, Params.Email);
                return (string.IsNullOrWhiteSpace(password)) ? error.InvalidParameters(Response) : Response.AsJson(new { Password = password });
            };

            Post["/validate"] = _ =>
            {
                if (Params.AreMissing("UserName", "Password")) return error.MissingParameters(Response);
                var user = userService.GetUserByName(Params.UserName);
                if (user == null || !passwordService.IsPasswordValid(user, Params.Password)) return error.NoUserForCredentials(Response);
                var key = userCacheService.Add(user);
                return (key == null) ? error.InvalidParameters(Response) : Response.AsJson(new { ThumbKey = key });
            };

            Post["/get"] = _ =>
            {
                if (Params.AreMissing("ThumbKey")) return error.MissingParameters(Response);
                if (!Params.ThumbKey.IsGuid()) return error.InvalidParameters(Response);
                var user = userCacheService.GetUser(Params.ThumbKey);
                return (user == null) ? error.NoUserForThumbkey(Response) : Response.AsJson(new { User = new { Id = user.Id, UserName = user.UserName, Email = user.Email } });
            };

            Post["/validate/thumbkey"] = _ =>
            {
                if (Params.AreMissing("ThumbKey")) return error.MissingParameters(Response);
                if (!Params.ThumbKey.IsGuid()) return error.InvalidParameters(Response);
                var isValid = userCacheService.Validate(Params.ThumbKey);
                return !isValid ? error.NoUserForThumbkey(Response) : HttpStatusCode.OK;
            };

            Post["/validate/name"] = _ =>
            {
                if (Params.AreMissing("UserName")) return error.MissingParameters(Response);
                var isValid = userService.GetUserByName(Params.UserName)==null;
                return !isValid ? error.UserNameTaken(Response) : HttpStatusCode.OK;
            };

            Post["/reset/password"] = _ =>
            {
                if (Params.AreMissing("UserName", "Password")) return error.MissingParameters(Response);
                var user = userService.GetUserByName(Params.UserName);
                if (user == null || !passwordService.IsPasswordValid(user, Params.Password)) return error.NoUserForCredentials(Response);
                var password = userService.ResetPassword(user);
                return (password == null) ? error.InvalidParameters(Response) : Response.AsJson(new { Password = password });
            };

            Post["/forgot-password/request"] = _ =>
            {
                if (Params.AreMissing("UserName", "Email")) return error.MissingParameters(Response);
                if (!Params.Email.IsEmail()) return error.InvalidParameters(Response);
                var user = userService.GetUserByName(Params.UserName);
                if (user == null) return error.NoUserForCredentials(Response);
                if (user.Email != Params.Email) return error.NoUserForEmail(Response);
                var token = userService.ForgotPasswordRequest(user);
                return (token == null) ? error.InvalidParameters(Response) : Response.AsJson(new { Token = token });
            };

            Post["/forgot-password/reset"] = _ =>
            {
                if (Params.AreMissing("UserName", "Token")) return error.MissingParameters(Response);
                if (!Params.Token.IsGuid()) return error.InvalidParameters(Response);
                var user = userService.GetUserByName(Params.UserName);
                if (user == null || !passwordService.IsForgotPasswordTokenValid(user, Params.Token)) return error.InvalidForgotPasswordToken(Response);
                var password = userService.ForgotPasswordReset(user);
                return (password == null) ? error.InvalidParameters(Response) : Response.AsJson(new { Password = password });
            };

            Post["/logout"] = _ =>
            {
                if (Params.AreMissing("ThumbKey")) return error.MissingParameters(Response);
                if (!Params.ThumbKey.IsGuid()) return error.InvalidParameters(Response);
                var success = userCacheService.Remove(Params.ThumbKey);
                return !success ? error.NoUserForThumbkey(Response) : HttpStatusCode.OK;
            };
        }
Exemplo n.º 49
0
 public UserProfile(IPasswordService passwordService)
 {
     _passwordService = passwordService;
 }
 public RegistrationLoginController(IPasswordService passwordService)
 {
     _passwordService = passwordService;
 }
 public void context()
 {
     _passwordService = CreatePasswordService();
     var controller = new RegistrationLoginController(_passwordService);
     actionResult = controller.Index("asdsadsadasdsaew312");
 }
 public void context()
 {
     passwordService = MockRepository.GenerateStub<IPasswordService>();
     var controller = new RegistrationChangePasswordConroller(passwordService);
     controller.ChangePassword("sdkajslkdsaj", "euwidhdjknwuwihd");
 }
Exemplo n.º 53
0
 public UserRegistrarImpl(IPasswordService pwd, ITimestampService timestamper)
 {
     _pwd = pwd;
       _timestamper = timestamper;
 }
        CVGSModelsEntities db = new CVGSModelsEntities(); // UoW is null so I'm using a new context here????!!!!!

        #endregion Fields

        #region Constructors

        public AccountControllerHelpers(ICVGSUow uow, IPasswordService pws)
        {
            UoW = uow;
            PWS = pws;
        }
Exemplo n.º 55
0
 public UserService(IRavenSessionProvider documentSessionProvider, IPasswordService pwd)
 {
     db = documentSessionProvider.Get();
     passwordService = pwd;
 }
 public RegistrationChangePasswordConroller(IPasswordService passwordService)
 {
     _passwordService = passwordService;
 }