Forgot or Reset password not working for blazor

I have set up the email confirmation as shown in radezn documentation for blazor.

Email confirmation works fine during registering new user, but forgot password link is not visible

I tweaked the razor markup and set it's visibility to true just to test it (was false by default), now can see it on the login page, but upon clicking it, nothing happens though, any pointers for this?

Definitely works on my end:

Here's what's happening on my end. I'm just now trying to add the Forgot Password feature into the security. I clicked the allowResetPassword flag on the Login page, but the functionality isn't activated. I don't see a form for Resetting the password. How do I get the functionality activated?

The only way i could get this to work was to change the reset/forgot link to open a new dialog and put in a standard html form with method="post" action="account/resetpassword" and change the parameter in the resetpassword method to be string Email, then it worked fine. Not sure why i can't get it to work as per @enchev's previous post but at least my method works even if there is a better solution.

And remember to put this new form and the accountcontroller in the list of excluded files.

1 Like

Can you show me what code/event you used to trigger the actual reset password function? The link shows up but doesn't seem to do anything. What am I missing to get this functionality up and running?


I changed the reset password link on the log in page to open a new page i called resetpasswordpage and on this new page i set the form submit action to be account/resetpassword


the reset passwordpage code is:

@page "/reset-password/{UserName}"
@layout LoginLayout
@inherits EsWlite.Pages.ResetPasswordComponent

@using Radzen
@using Radzen.Blazor
@using EsWlite.Models.Ecosys
@using Microsoft.AspNetCore.Identity;
@using EsWlite.Models
@using Microsoft.AspNetCore.Authorization

@inject Microsoft.Extensions.Localization.IStringLocalizer<ResetPassword> L
    <form method="post" action="account/resetpassword">
          <RadzenContent Container="main">
                    <div style="margin-bottom: 1rem" class="row">
                      <div class="col-md-12">
                        <RadzenTextBox style="display: block; width: 100%" @bind-Value="@Email" Name="Email">
                        <RadzenRequiredValidator Component="TextBox1" style="position: absolute" Text="@L["requiredValidator1.Text"]">
                    <div class="row">
                      <div class="offset-sm-3 col-md-12" style="margin-left: 0px">
                        <RadzenButton ButtonType="ButtonType.Submit" Text="@L["button0.Text"]">
                        <RadzenButton ButtonStyle="ButtonStyle.Light" Text="@L["button1.Text"]" Click="@Button1Click">


i had to change the Radzenform to be a normal form to get the account/resetpassword to work.

And finally i had to change the parameter for the resetpassword method to be a string

    public async Task<IActionResult> ResetPassword(string Email)
        var user = await userManager.FindByNameAsync(Email);

        if (user == null)
            return Redirect("~/Login?error=Invalid user");

        if (!user.EmailConfirmed)
            return Redirect("~/Login?error=User email not confirmed");

        await SendResetPasswordEmail(userManager, user, Url, Request.Scheme);

        return Redirect("~/Login");

the parameter being the name of the form field passed by the onsubmit event.

Hope this helps, but i'd be interested to know how Vladimir and Atanas get it to work differently.



1 Like

Thanks John for all this, you definitely went way above and beyond and I really appreciate it.

@enchev After reviewing John's work and working to implement it, it became clear to me that there is something missing from my application. Again it's very likely because I didn't add security and email until later in the process, but the entire reset password functionality listed in John's example is missing. There's no ResetPassword method and there's no SendResetPasswordEmail method as well for me to call. Can someone please take a look at my application and give me some guidance?

Hi @kgordon,

The password reset works only when email confirmation is enabled:

When you setup this feature you will be able to send emails to reset password.

In the upcoming update (later today) the reset password will be implemented directly in our templates:

Thank you for this update. Works beautifully!

Hello! Somehow the forgot password is not working. The link is there but nothing happens. I also noticed that there is no event handler under the forgot password, like there is in your screenshot. Email confirmation is also enabled. Am I missing something?


The code for ResetPassord event is missing.