/// <summary>
 /// Ctor
 /// </summary>
 /// <param name="httpContext">HTTP context</param>
 /// <param name="userService">User service</param>
 /// <param name="userSettings">User settings</param>
 public FormsAuthenticationService(HttpContextBase httpContext,
     IUserService userService, UserSettings userSettings)
 {
     this._httpContext = httpContext;
     this._userService = userService;
     this._userSettings = userSettings;
     this._expirationTimeSpan = FormsAuthentication.Timeout;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="userService">User service</param>
 /// <param name="encryptionService">Encryption service</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="userSettings">User settings</param>
 public UserRegistrationService(IUserService userService, 
     IEncryptionService encryptionService, 
     ILocalizationService localizationService,
     UserSettings userSettings)
 {
     this._userService = userService;
     this._encryptionService = encryptionService;
     this._localizationService = localizationService;
     this._userSettings = userSettings;
 }
Example #3
0
        public CommonController(
            ILanguageService languageService,
            ILocalizationService localizationService,
            IWorkContext workContext, 
            IQueuedEmailService queuedEmailService, 
            IEmailAccountService emailAccountService,
            ISitemapGenerator sitemapGenerator,
            IGenericAttributeService genericAttributeService, 
            IWebHelper webHelper,
            IPermissionService permissionService,
            ICacheManager cacheManager,
            IUserActivityService userActivityService,
            UserSettings userSettings, 
            SiteInformationSettings siteInformationSettings,
            EmailAccountSettings emailAccountSettings,
            CommonSettings commonSettings, 
            LocalizationSettings localizationSettings, 
            CaptchaSettings captchaSettings)
        {
            this._languageService = languageService;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._queuedEmailService = queuedEmailService;
            this._emailAccountService = emailAccountService;
            this._sitemapGenerator = sitemapGenerator;
            this._genericAttributeService = genericAttributeService;
            this._webHelper = webHelper;
            this._permissionService = permissionService;
            this._cacheManager = cacheManager;
            this._userActivityService = userActivityService;

            this._userSettings = userSettings;
            this._siteInformationSettings = siteInformationSettings;
            this._emailAccountSettings = emailAccountSettings;
            this._commonSettings = commonSettings;
            this._localizationSettings = localizationSettings;
            this._captchaSettings = captchaSettings;
        }
Example #4
0
        public UserService(ICacheManager cacheManager,
            IRepository<User> userRepository,
            IRepository<UserRole> userRoleRepository,
            IRepository<GenericAttribute> gaRepository,
            IGenericAttributeService genericAttributeService,
            IDataProvider dataProvider,
            IDbContext dbContext,
            IEventPublisher eventPublisher, 
            UserSettings userSettings,
            CommonSettings commonSettings)
        {
            this._cacheManager = cacheManager;
            this._userRepository = userRepository;
            this._userRoleRepository = userRoleRepository;
            this._gaRepository = gaRepository;

            this._genericAttributeService = genericAttributeService;
            this._dataProvider = dataProvider;
            this._dbContext = dbContext;
            this._eventPublisher = eventPublisher;
            this._userSettings = userSettings;
            this._commonSettings = commonSettings;
        }
Example #5
0
        /// <summary>
        /// Check whether password recovery link is expired
        /// </summary>
        /// <param name="user">User</param>
        /// <param name="userSettings">User settings</param>
        /// <returns>Result</returns>
        public static bool IsPasswordRecoveryLinkExpired(this User user, UserSettings userSettings)
        {
            if (user == null)
                throw new ArgumentNullException("user");

            if (userSettings == null)
                throw new ArgumentNullException("userSettings");

            if (userSettings.PasswordRecoveryLinkDaysValid == 0)
                return false;

            var geneatedDate = user.GetAttribute<DateTime?>(SystemUserAttributeNames.PasswordRecoveryTokenDateGenerated);
            if (!geneatedDate.HasValue)
                return false;

            var daysPassed = (DateTime.UtcNow - geneatedDate.Value).TotalDays;
            if (daysPassed > userSettings.PasswordRecoveryLinkDaysValid)
                return true;

            return false;
        }