I have set up an ASP.NET Core 5 web app with Identity. Everything works. The only issue is that after a new user clicks on the link in their email confirmation, the message shown on the site says "confirm email". The confirmation works, but the message is confusing users.
The address it gets sent to is:
https://baseurl/Identity/Account/ConfirmEmail?userId=********
None of the files inside the Identity/Account folder contain the displayed message. Is it possible to change this message and if so how is this achieved?
The default ASP.NET Core Identity setup contains a lot of Razor pages that are included by default to make Identity work.
In your case, the email is being sent by the Register.cshtml
page:
await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
$"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");
And the callbackUrl
then leads to the ConfirmEmail.cshtml
which displays the status message:
StatusMessage = result.Succeeded ? "Thank you for confirming your email." : "Error confirming your email.";
It is possible to scaffold the Identity UI, either partially or in full, and have the Identity scaffolder copy the pages into your project so that you can modify them. This allows you to replace the default behavior completely so that you can change the text, the design, or even what the pages do.