Skip to content

Commit ac443ed

Browse files
authored
[pm-13985] Add a cancel endpoint to prevent authorization errors (#5229)
1 parent f80acae commit ac443ed

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Admin/AdminConsole/Controllers/ProvidersController.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,18 @@ public async Task<IActionResult> Edit(Guid id)
251251
return View(provider);
252252
}
253253

254+
[SelfHosted(NotSelfHostedOnly = true)]
255+
public async Task<IActionResult> Cancel(Guid id)
256+
{
257+
var provider = await GetEditModel(id);
258+
if (provider == null)
259+
{
260+
return RedirectToAction("Index");
261+
}
262+
263+
return RedirectToAction("Edit", new { id });
264+
}
265+
254266
[HttpPost]
255267
[ValidateAntiForgeryToken]
256268
[SelfHosted(NotSelfHostedOnly = true)]

src/Admin/AdminConsole/Views/Providers/CreateOrganization.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<div class="d-flex mt-4">
2020
<button type="submit" class="btn btn-primary" form="edit-form">Save</button>
2121
<div class="ms-auto d-flex">
22-
<form asp-controller="Providers" asp-action="Edit" asp-route-id="@Model.Provider.Id"
23-
onsubmit="return confirm('Are you sure you want to cancel?')">
22+
<form asp-controller="Providers" asp-action="Cancel" asp-route-id="@Model.Provider.Id"
23+
onsubmit="return confirm('Are you sure you want to cancel?')">
2424
<button class="btn btn-outline-secondary" type="submit">Cancel</button>
2525
</form>
2626
</div>

0 commit comments

Comments
 (0)