Fix: Add missing CSRF token to Categories Edit form
**Issue**: Edit category functionality failing with AntiforgeryValidationException
- Error: "The required antiforgery request token was not provided"
- POST requests to /Admin/Categories/Edit/{id} returning 400 Bad Request
**Root Cause**:
- Categories/Edit.cshtml form missing @Html.AntiForgeryToken()
- Create and Delete forms already had the token
- Edit was the only form missing CSRF protection
**Solution**:
- Added @Html.AntiForgeryToken() to Edit.cshtml (line 19)
- Matches pattern used in Create.cshtml and Index.cshtml delete forms
**Files Changed**:
- LittleShop/Areas/Admin/Views/Categories/Edit.cshtml
**Testing**:
- Deployed to production (container: littleshop-admin restarted)
- Edit category form now includes __RequestVerificationToken field
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
fa5e5fb9fa
commit
8a3341b59f
@ -16,6 +16,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form method="post" action="@Url.Action("Edit", new { id = categoryId })">
|
<form method="post" action="@Url.Action("Edit", new { id = categoryId })">
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
@if (ViewData.ModelState.ErrorCount > 0)
|
@if (ViewData.ModelState.ErrorCount > 0)
|
||||||
{
|
{
|
||||||
<div class="alert alert-danger" role="alert">
|
<div class="alert alert-danger" role="alert">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user