[Fixes #9079] Correctly route forgot password and error when using a virtual path (#9738)

This commit is contained in:
Javier Calvarro Nelson 2019-04-30 11:53:38 +02:00 committed by GitHub
parent 3020264ec7
commit 5c7c621895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.using Microsoft.AspNetCore.Authorization;
using System;
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
if (context.Failure is OpenIdConnectProtocolException && context.Failure.Message.Contains("AADB2C90118"))
{
// If the user clicked the reset password link, redirect to the reset password route
context.Response.Redirect($"/AzureADB2C/Account/ResetPassword/{SchemeName}");
context.Response.Redirect($"{context.Request.PathBase}/AzureADB2C/Account/ResetPassword/{SchemeName}");
}
// Access denied errors happen when a user cancels an action on the Azure Active Directory B2C UI. We just redirect back to
// the main page in that case.
@ -75,11 +75,11 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
// ', error_uri: 'error_uri is null'.
else if (context.Failure is OpenIdConnectProtocolException && context.Failure.Message.Contains("access_denied"))
{
context.Response.Redirect("/");
context.Response.Redirect($"{context.Request.PathBase}/");
}
else
{
context.Response.Redirect("/AzureADB2C/Account/Error");
context.Response.Redirect($"{context.Request.PathBase}/AzureADB2C/Account/Error");
}
return Task.CompletedTask;