public static ApplicationUserManager Create(IdentityFactoryOptions <ApplicationUserManager> options, IOwinContext context)
        {
            var manager = new ApplicationUserManager(new UserStore <Customer>(SweetShopContext.Create()));

            // Configure validation logic for usernames
            manager.UserValidator = new UserValidator <Customer>(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 <Customer>
            {
                MessageFormat = "Your security code is {0}"
            });
            manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider <Customer>
            {
                Subject    = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            manager.EmailService = new EmailService();
            manager.SmsService   = new SmsService();
            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider =
                    new DataProtectorTokenProvider <Customer>(dataProtectionProvider.Create("ASP.NET Identity"));
            }
            return(manager);
        }
Example #2
0
        public UnitOfWork()
        {
            object oylesine = "";

            if (db == null)
            {
                lock (oylesine)
                {
                    if (db == null)
                    {
                        db = new SweetShopContext();
                    }
                }
            }
            Products   = new BaseRepoSitory <Product>(db);
            Categories = new BaseRepoSitory <Category>(db);
        }
 public TreatsController(UserManager <ApplicationUser> userManager, SweetShopContext db)
 {
     _userManager = userManager;
     _db          = db;
 }
Example #4
0
 public FlavorsController(SweetShopContext db)
 {
     _db = db;
 }
 public AccountController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, SweetShopContext db)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _db            = db;
 }
Example #6
0
 public BaseRepoSitory(SweetShopContext db)
 {
     _db = db;
 }
Example #7
0
 public SqlServerDbService(SweetShopContext context)
 {
     _context = context;
 }
Example #8
0
 public TreatsController(SweetShopContext db)
 {
     _db = db;
 }