From ec9635265683219d0ed38fb2203f6967c3379348 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 16 May 2024 08:15:25 -0700 Subject: [PATCH 1/2] Remove the ReturnUrl from the user's profile link --- .../OrchardCore.Users/Views/UserMenuItems-Profile.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml index 8c0f85aa384..df3a7d41986 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml @@ -5,7 +5,7 @@ @if (await AuthorizationService.AuthorizeAsync(User, CommonPermissions.EditOwnUser)) {
  • - + @T["Profile"]
  • @@ -13,7 +13,7 @@ else if (await AuthorizationService.AuthorizeAsync(User, CommonPermissions.ViewUsers)) {
  • - + @T["Profile"]
  • From ce92f23fd4693bc4061030c2d7068c90061668ed Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 16 May 2024 13:13:31 -0700 Subject: [PATCH 2/2] Fix the controler redirect logic --- .../Controllers/AdminController.cs | 13 ++++--------- .../Views/UserMenuItems-Profile.cshtml | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs index ff6cb9297c1..7cf771b6af6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs @@ -418,19 +418,14 @@ public async Task EditPost(string id, string returnUrl) await _notifier.SuccessAsync(H["User updated successfully."]); - if (editingOwnUser) + if (!string.IsNullOrEmpty(returnUrl)) { - if (!string.IsNullOrEmpty(returnUrl)) - { - return this.LocalRedirect(returnUrl, true); - } - - return RedirectToAction(nameof(Edit)); + return this.LocalRedirect(returnUrl, true); } - if (!string.IsNullOrEmpty(returnUrl)) + if (editingOwnUser) { - return this.LocalRedirect(returnUrl, true); + return RedirectToAction(nameof(Edit)); } return RedirectToAction(nameof(Index)); diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml index df3a7d41986..370accd50b2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenuItems-Profile.cshtml @@ -5,7 +5,7 @@ @if (await AuthorizationService.AuthorizeAsync(User, CommonPermissions.EditOwnUser)) {
  • - + @T["Profile"]