Skip to content

Commit

Permalink
email confirmation test4
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystianKempski committed Apr 30, 2024
1 parent 9c60328 commit 74b120f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ 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;
//if (DisplayConfirmAccountLink)
//{
// var userId = await _userManager.GetUserIdAsync(user);
// var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
// code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
// EmailConfirmationUrl = Url.Page(
// "/Account/ConfirmEmail",
// pageHandler: null,
// values: new { area = "Identity", userId = userId, code = code, returnUrl = returnUrl },
// protocol: Request.Scheme);
//}
if (DisplayConfirmAccountLink)
{
var userId = await _userManager.GetUserIdAsync(user);
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
EmailConfirmationUrl = Url.Page(
"/Account/ConfirmEmail",
pageHandler: null,
values: new { area = "Identity", userId = userId, code = code, returnUrl = returnUrl },
protocol: Request.Scheme);
}

return Page();
}
Expand Down
2 changes: 1 addition & 1 deletion DagoniteEmpire/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

builder.Services.AddIdentity<IdentityUser, IdentityRole>(config =>
{
config.SignIn.RequireConfirmedEmail = true;
// config.SignIn.RequireConfirmedEmail = true;
config.SignIn.RequireConfirmedAccount = true;
}).AddDefaultTokenProviders().AddDefaultUI().AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
Expand Down

0 comments on commit 74b120f

Please sign in to comment.