Ends in:
4 DAYS
6 HRS
11 MIN
16 SEC
Ends in:
4 D
6 H
11 M
16 S
Open Closed

Forgot password reset link not working #5242


User avatar
0
shobhit created
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"
  1. On login page, select tenant "t1" and click on Forgot password? link.
  2. In "forgot password" page provide email address
  3. User will receive an email containing a password reset link.
  4. Click on that password reset link or copy and paste it into a incognito (Private) window of browser or any other browser
  5. You will see a blank page when browser loads that URL link.

My Conclusion: If reset password link could not find the tenant in the browser (due to incogito mode or different browser or device) then it breaks.


8 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Could you share the error logs? thanks.

  • User Avatar
    0
    shobhit created

    Where i can get the error logs?

  • User Avatar
    0
    Long.Nguyen created

    In the root level of service, it should have a folder named "Logs" and "logs.txt" inside. If you run in debugging mode, it should be in: "\bin\Debug\net6.0\Logs" for example.

  • User Avatar
    0
    shobhit created

    Thanks. Will look and share.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok

  • User Avatar
    0
    shobhit created

    Hello Liangshiwei, Please find the logs:

    Scenario: 1- As a user i click on"forget Password" in "Chrome" browser. Select tenant and provide email address. User receive the email. 2- Copy the password reset link 3- use password reset link in "Chrome" browser, got the password reset page 4- use password reset link in any other browser, got the error in page and got below error in Logs.txt 5- Please help.

    2023-06-22 16:06:27.018 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44388/Account/ResetPassword?userId=802abf7c-72ae-ab4c-bd78-3a0bf4cff44c&tenantId=951c9104-027e-5496-2324-3a08bc7a483e&resetToken=CfDJ8H%2BpNH6zNV9Ohi2CAcO2wpoQJlb8Bq2a%2BRax6DmZLlyaKmUbUuix4%2B7BskrNtthTygjLPfGGbgENMsAk2JMp7RI%2B25B6UckOe%2B21bNcaSPEyU3zkID%2Bbr9o9mmjTQlImwYx0wZoU%2FjELvApMYGZtt%2B%2Fil2zM2IjcE5cv0OgRg7hawGWa6EkQG9WjDrzcS2izx2%2Fk6FveGGikR2Dv0yq0C0pnosdZqLCXrQTWBArcppoo - - - 500 - - 21470.7398ms 2023-06-22 16:06:29.764 +05:30 [INF] Executing endpoint '/Account/ResetPassword' 2023-06-22 16:06:29.764 +05:30 [INF] Route matched with {page = "/Account/ResetPassword", area = "", action = "", controller = ""}. Executing page /Account/ResetPassword 2023-06-22 16:06:29.764 +05:30 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2023-06-22 16:06:47.237 +05:30 [INF] Executing handler method Volo.Abp.Account.Public.Web.Pages.Account.ResetPasswordModel.OnGetAsync - ModelState is "Valid" 2023-06-22 16:06:47.237 +05:30 [INF] Executed page /Account/ResetPassword in 17473.4679ms 2023-06-22 16:06:47.237 +05:30 [INF] Executed endpoint '/Account/ResetPassword' 2023-06-22 16:06:48.317 +05:30 [ERR] Connection ID "18086456105130524694", Request ID "80000017-0000-fb00-b63f-84710c7967bb": An unhandled exception was thrown by the application. System.ApplicationException: Current tenant is different than given tenant. CurrentTenant.Id: , given tenantId: 951c9104-027e-5496-2324-3a08bc7a483e at Volo.Abp.Account.Public.Web.Pages.Account.AccountPageModel.CheckCurrentTenant(Nullable1 tenantId) in C:\Shobhit\Projile\Aztute\aspnet-core\modules\Volo.Account.Pro\src\Volo.Abp.Account.Pro.Public.Web\Pages\Account\AccountPageModel.cs:line 70 at Volo.Abp.Account.Public.Web.Pages.Account.ResetPasswordModel.OnGetAsync() in C:\Shobhit\Projile\Aztute\aspnet-core\modules\Volo.Account.Pro\src\Volo.Abp.Account.Pro.Public.Web\Pages\Account\ResetPassword.cshtml.cs:line 62 at lambda_method4160(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService) at IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT1.ProcessRequestAsync() 2023-06-22 16:06:48.318 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44388/Account/ResetPassword?userId=802abf7c-72ae-ab4c-bd78-3a0bf4cff44c&tenantId=951c9104-027e-5496-2324-3a08bc7a483e&resetToken=CfDJ8H%2BpNH6zNV9Ohi2CAcO2wpoQJlb8Bq2a%2BRax6DmZLlyaKmUbUuix4%2B7BskrNtthTygjLPfGGbgENMsAk2JMp7RI%2B25B6UckOe%2B21bNcaSPEyU3zkID%2Bbr9o9mmjTQlImwYx0wZoU%2FjELvApMYGZtt%2B%2Fil2zM2IjcE5cv0OgRg7hawGWa6EkQG9WjDrzcS2izx2%2Fk6FveGGikR2Dv0yq0C0pnosdZqLCXrQTWBArcppoo - - - 500 - - 21786.6273ms

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try this:

    public class MyTenantResolveContributor : HttpTenantResolveContributorBase
    {
        public const string ContributorName = "Custom";
    
        public override string Name => ContributorName;
    
        protected override Task<string> GetTenantIdOrNameFromHttpContextOrNullAsync(ITenantResolveContext context, HttpContext httpContext)
        {
            if (httpContext.Request.QueryString.HasValue)
            {
                var tenantKey = "tenantId"
                if (httpContext.Request.Query.ContainsKey(tenantKey))
                {
                    var tenantValue = httpContext.Request.Query[tenantKey].ToString();
                    if (tenantValue.IsNullOrWhiteSpace())
                    {
                        context.Handled = true;
                        return Task.FromResult<string>(null);
                    }
    
                    return Task.FromResult(tenantValue);
                }
            }
    
            return Task.FromResult<string>(null);
        }
    }
    
    Configure<AbpTenantResolveOptions>(options =>
    {
        options.TenantResolvers.Insert(1, new MyTenantResolveContributor());
    });
    
  • User Avatar
    0
    shobhit created

    Thanks. Working for me.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35