Exemple #1
0
        public static UserManager<ApplicationUser> CreateUserManager(IDataProtectionProvider dataProtectionProvider, IPartsUnlimitedContext context)
        {
            var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>((DbContext)context));
            // Configure validation logic for usernames
            manager.UserValidator = new UserValidator<ApplicationUser>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail = true
            };

            // Configure validation logic for passwords
            manager.PasswordValidator = new PasswordValidator
            {
                RequiredLength = 6,
                RequireNonLetterOrDigit = true,
                RequireDigit = true,
                RequireLowercase = true,
                RequireUppercase = true,
            };

            // Configure user lockout defaults
            manager.UserLockoutEnabledByDefault = true;
            manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
            manager.MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser>
            {
                MessageFormat = "Your security code is {0}"
            });
            manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser>
            {
                Subject = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            manager.EmailService = new EmailService();
            manager.SmsService = new SmsService();

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }

            return manager;
        }
 public StoreManagerController(IPartsUnlimitedContext context)
 {
     db = context;
 }
 public CategoryMenuComponent(IPartsUnlimitedContext context, IMemoryCache memoryCache)
 {
     _db = context;
     _cache = memoryCache;
 }
Exemple #4
0
 public CartSummaryComponent(IPartsUnlimitedContext context)
 {
     _db = context;
 }
 public RaincheckQuery(IPartsUnlimitedContext context)
 {
     _context = context;
 }
Exemple #6
0
 public CustomerController(IPartsUnlimitedContext context)
 {
     _context = context;
 }
 public RecommendationsController(IPartsUnlimitedContext context, IRecommendationEngine recommendationEngine, IWebsiteOptions websiteOptions)
 {
     _db = context;
     _recommendation = recommendationEngine;
     _option = websiteOptions;
 }
 public StringContainsProductSearch(IPartsUnlimitedContext context)
 {
     _context = context;
 }
        public ShoppingCartController(IPartsUnlimitedContext context, IAntiforgery antiforgery)
        {
            _db = context;

            _antiforgery = antiforgery;
        }
Exemple #10
0
 public StoreManagerController(IPartsUnlimitedContext context, IConnectionManager connectionManager, IMemoryCache memoryCache)
 {
     _db             = context;
     _annoucementHub = connectionManager.GetHubContext <AnnouncementHub>();
     _cache          = memoryCache;
 }
Exemple #11
0
 public ShoppingCartController(IPartsUnlimitedContext context, ITelemetryProvider telemetryProvider, IAntiforgery antiforgery)
 {
     _db          = context;
     _telemetry   = telemetryProvider;
     _antiforgery = antiforgery;
 }
Exemple #12
0
 public ShoppingCart(IPartsUnlimitedContext db, IProductsRepository productsRepository)
 {
     _db = db;
     this.productsRepository = productsRepository;
 }
 public CheckoutController(IPartsUnlimitedContext context, UserManager <ApplicationUser> userManager)
 {
     _userManager = userManager;
     _db          = context;
 }
Exemple #14
0
 public ShoppingCartController(IPartsUnlimitedContext context, ITelemetryProvider telemetryProvider)
 {
     db        = context;
     telemetry = telemetryProvider;
 }
Exemple #15
0
 public RecommendationsController(IPartsUnlimitedContext context, IRecommendationEngine recommendationEngine)
 {
     db             = context;
     recommendation = recommendationEngine;
 }
Exemple #16
0
 public OrdersQuery(IPartsUnlimitedContext context, IProductsRepository productsRepository)
 {
     _db = context;
     this.productsRepository = productsRepository;
 }
 public StringContainsProductSearch(IPartsUnlimitedContext context)
 {
     _context = context;
 }
 public CheckoutController(IPartsUnlimitedContext context, UserManager <ApplicationUser> userManager, IConfiguration configuration)
 {
     _userManager  = userManager;
     _db           = context;
     Configuration = configuration;
 }
 public ShoppingCartController(IPartsUnlimitedContext context, ITelemetryProvider telemetryProvider)
 {
     _db = context;
     _telemetry = telemetryProvider;
 }
 public RecommendationsController(IPartsUnlimitedContext context, IRecommendationEngine recommendationEngine)
 {
     db = context;
     recommendation = recommendationEngine;
 }
Exemple #21
0
 public ShoppingCart(IPartsUnlimitedContext db)
 {
     _db = db;
 }
Exemple #22
0
 public HomeController(IPartsUnlimitedContext context)
 {
     _db = context;
 }
 public ProductsController(IPartsUnlimitedContext context)
 {
     _context = context;
 }
 public CategoryMenuComponent(IPartsUnlimitedContext context, IMemoryCache memoryCache)
 {
     _db    = context;
     _cache = memoryCache;
 }
Exemple #25
0
 public RaincheckQuery(IPartsUnlimitedContext context, IProductsRepository productsRepository)
 {
     _context = context;
     this.productsRepository = productsRepository;
 }
Exemple #26
0
 public RaincheckQuery(IPartsUnlimitedContext context)
 {
     _context = context;
 }
 public ProductsController(IPartsUnlimitedContext context)
 {
     _context = context;
 }
 public AnnouncementComponent(IPartsUnlimitedContext context, IMemoryCache memoryCache)
 {
     _db    = context;
     _cache = memoryCache;
 }
 public CustomerController(IPartsUnlimitedContext context)
 {
     _context = context;
 }
Exemple #30
0
 public CheckoutController(IPartsUnlimitedContext context)
 {
     db = context;
 }
Exemple #31
0
 public HomeController(IPartsUnlimitedContext context)
 {
     _db = context;
 }
Exemple #32
0
 public ShoppingCart(IPartsUnlimitedContext db)
 {
     _db = db;
 }
 public HomeController(IPartsUnlimitedContext context, IMemoryCache memoryCache)
 {
     _db    = context;
     _cache = memoryCache;
 }
Exemple #34
0
 public StoreManagerController(IPartsUnlimitedContext context, IMemoryCache memoryCache)
 {
     _db    = context;
     _cache = memoryCache;
 }
 public CheckoutController(IPartsUnlimitedContext context, UserManager<ApplicationUser> userManager)
 {
     _userManager = userManager;
     _db = context;
 }
Exemple #36
0
 public RecommendationsController(IPartsUnlimitedContext context, IRecommendationEngine recommendationEngine, IWebsiteOptions websiteOptions)
 {
     _db             = context;
     _recommendation = recommendationEngine;
     _option         = websiteOptions;
 }
 public ShoppingCartController(IPartsUnlimitedContext context, ITelemetryProvider telemetryProvider, IAntiforgery antiforgery)
 {
     _db = context;
     _telemetry = telemetryProvider;
     _antiforgery = antiforgery;
 }
Exemple #38
0
 public StoreController(IPartsUnlimitedContext context, IMemoryCache memoryCache, IProductsRepository productsRepository)
 {
     _db    = context;
     _cache = memoryCache;
     this.productsRepository = productsRepository;
 }
 public CartSummaryComponent(IPartsUnlimitedContext context)
 {
     _db = context;
 }
Exemple #40
0
 public OrdersQuery(IPartsUnlimitedContext context)
 {
     _db = context;
 }
 public AnnouncementComponent(IPartsUnlimitedContext context, IMemoryCache memoryCache)
 {
     _db = context;
     _cache = memoryCache;
 }
 public CheckoutController(IPartsUnlimitedContext context, IProductsRepository productsRepository)
 {
     _db = context;
     this.productsRepository = productsRepository;
 }
Exemple #43
0
 public static ShoppingCart GetCart(IPartsUnlimitedContext db, HttpContextBase context)
 {
     var cart = new ShoppingCart(db);
     cart.ShoppingCartId = cart.GetCartId(context);
     return cart;
 }
 public StoreManagerController(IPartsUnlimitedContext context, ConnectionManager connectionManager, IMemoryCache memoryCache)
 {
     _db = context;
     _cache = memoryCache;
 }
 public StoreManagerController(IPartsUnlimitedContext context, IConnectionManager connectionManager, IMemoryCache memoryCache)
 {
     _db = context;
     _annoucementHub = connectionManager.GetHubContext<AnnouncementHub>();
     _cache = memoryCache;
 }
Exemple #46
0
 public OrdersQuery(IPartsUnlimitedContext context)
 {
     _db = context;
 }
 public CheckoutController(IPartsUnlimitedContext context)
 {
     _db = context;
 }
Exemple #48
0
 public StoreController(IPartsUnlimitedContext context)
 {
     db = context;
 }
 public StoreController(IPartsUnlimitedContext context, IMemoryCache memoryCache)
 {
     _db = context;
     _cache = memoryCache;
 }
Exemple #50
0
        public static UserManager <ApplicationUser> CreateUserManager(IDataProtectionProvider dataProtectionProvider, IPartsUnlimitedContext context)
        {
            var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>((DbContext)context));

            // Configure validation logic for usernames
            manager.UserValidator = new UserValidator <ApplicationUser>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = true
            };

            // Configure validation logic for passwords
            manager.PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 6,
                RequireNonLetterOrDigit = true,
                RequireDigit            = true,
                RequireLowercase        = true,
                RequireUppercase        = true,
            };

            // Configure user lockout defaults
            manager.UserLockoutEnabledByDefault          = true;
            manager.DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
            manager.MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider <ApplicationUser>
            {
                MessageFormat = "Your security code is {0}"
            });
            manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider <ApplicationUser>
            {
                Subject    = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            manager.EmailService = new EmailService();
            manager.SmsService   = new SmsService();

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider = new DataProtectorTokenProvider <ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }

            return(manager);
        }