- 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:"
- On login page, select tenant "t1" and click on Forgot password? link.
- In "forgot password" page provide email address
- User will receive an email containing a password reset link.
- Click on that password reset link or copy and paste it into a incognito (Private) window of browser or any other browser
- 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)
-
0
Could you share the error logs? thanks.
-
0
Where i can get the error logs?
-
0
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.
-
0
Thanks. Will look and share.
-
0
ok
-
0
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(Nullable
1 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.IISHttpContextOfT
1.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 -
0
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()); });
-
0
Thanks. Working for me.