/// <summary> /// Custom validate when sign in /// </summary> public override Task <bool> CanSignInAsync(MbpUser user) { var isConfirmedAccount = user.PhoneNumberConfirmed || user.EmailConfirmed; var isActiveAccount = user.Status == Status.ACTIVE; var canSignIn = isConfirmedAccount && isActiveAccount; return(Task.FromResult(canSignIn)); }
private static async Task UpdateAdminAsync(IServiceProvider services) { var userManager = services.GetRequiredService <UserManager <MbpUser> >(); var admin = await userManager.FindByNameAsync("Admin"); if (admin == null) { admin = new MbpUser { UserName = "******", FullName = "Admin", Email = "*****@*****.**", EmailConfirmed = true, PhoneNumberConfirmed = true, Status = Status.ACTIVE, }; await userManager.CreateAsync(admin, "Pass@123#"); } }