You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After I scaffolded ASP.NET Core Identity into my Blazor (Server) project I noticed that I was unable to change email address using the function presented on Account\Manage\Email.cshtml
The email confirmation would send as expected however when I clicked on the link the value of result.Succeeded on line 42 of Account\ConfirmEmailChange.cshtml.cs was always false.
code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code));
var result = await _userManager.ChangeEmailAsync(user, email, code);
if (!result.Succeeded)
{
StatusMessage = "Error changing email.";
return Page();
}
In noticed on Account\Manage\Email.cshtml.cs that within OnPostSendVerificationEmailAsync() after the token code was generated on line 129 using await _userManager.GenerateEmailConfirmationTokenAsync(user) that it was then encoded using code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
This encoding is missing within OnPostChangeEmailAsync() after var code = await _userManager.GenerateChangeEmailTokenAsync(user, Input.NewEmail); on line 93.
When I add code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); to line 94 the issue is resolved and result.Succeeded returns true.
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
After I scaffolded ASP.NET Core Identity into my Blazor (Server) project I noticed that I was unable to change email address using the function presented on Account\Manage\Email.cshtml
The email confirmation would send as expected however when I clicked on the link the value of result.Succeeded on line 42 of Account\ConfirmEmailChange.cshtml.cs was always false.
In noticed on Account\Manage\Email.cshtml.cs that within OnPostSendVerificationEmailAsync() after the token code was generated on line 129 using
await _userManager.GenerateEmailConfirmationTokenAsync(user)
that it was then encoded usingcode = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
This encoding is missing within OnPostChangeEmailAsync() after var code =
await _userManager.GenerateChangeEmailTokenAsync(user, Input.NewEmail);
on line 93.When I add
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
to line 94 the issue is resolved and result.Succeeded returns true.Thanks
The text was updated successfully, but these errors were encountered: