Skip to content

Commit

Permalink
email confirmation test3
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystianKempski committed Apr 29, 2024
1 parent 035bd63 commit 9c60328
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task<IActionResult> OnGetAsync(string email, string returnUrl = nul

Email = email;
// Once you add a real email sender, you should remove this code that lets you confirm the account
//DisplayConfirmAccountLink = false;
DisplayConfirmAccountLink = false;
//if (DisplayConfirmAccountLink)
//{
// var userId = await _userManager.GetUserIdAsync(user);
Expand Down
8 changes: 6 additions & 2 deletions DagoniteEmpire/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
//options.EnableSensitiveDataLogging();
});

builder.Services.AddIdentity<IdentityUser, IdentityRole>().AddDefaultTokenProviders().AddDefaultUI().AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddIdentity<IdentityUser, IdentityRole>(config =>
{
config.SignIn.RequireConfirmedEmail = true;
config.SignIn.RequireConfirmedAccount = true;
}).AddDefaultTokenProviders().AddDefaultUI().AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddScoped<ICharacterRepository, CharacterRepository>();
builder.Services.AddScoped<IAttributeRepository, AttributeRepository>();
Expand Down Expand Up @@ -83,7 +87,7 @@
app.UseMiddleware<ErrorHandlingMiddleware>();
app.UseHttpsRedirection();

app.Services.CreateScope().ServiceProvider.GetRequiredService<IOptions<IdentityOptions>>().Value.SignIn.RequireConfirmedAccount = true;
//app.Services.CreateScope().ServiceProvider.GetRequiredService<IOptions<IdentityOptions>>().Value.SignIn.RequireConfirmedAccount = true;

app.UseStaticFiles();

Expand Down

0 comments on commit 9c60328

Please sign in to comment.