コード例 #1
0
        public static ApplicationUserManager Create(IdentityFactoryOptions <ApplicationUserManager> options, IOwinContext context)
        {
            var dbContext = MoneyDbContext.Create();

            var manager = new ApplicationUserManager(new UserStore <ApplicationUser>(dbContext));

            // 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,
            };
            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider = new DataProtectorTokenProvider <ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }
            return(manager);
        }
コード例 #2
0
 public CategoryController(UserManager <ApplicationUser> userManager, MoneyDbContext db)
 {
     _userManager = userManager;
     _db          = db;
 }
コード例 #3
0
 public TransactionController(UserManager <ApplicationUser> userManager, MoneyDbContext db)
 {
     _userManager = userManager;
     _db          = db;
 }
コード例 #4
0
ファイル: MoneyService.cs プロジェクト: ejiu4cj86/MVC-Money
 public MoneyService()
 {
     this.model1 = new MoneyDbContext();
 }
コード例 #5
0
 public AccountController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, MoneyDbContext db)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _db            = db;
 }