-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from episerver/bugfix/MAR-1630-missing-antifor…
…gery-token-on-setting-page Add antiforgery token to verify Save setting api
- Loading branch information
Showing
5 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/EPiServer.Marketing.Testing.Web/ClientResources/Config/src/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import App from "./App"; | ||
import axios from "axios"; | ||
|
||
const root = document.getElementById("root") as HTMLElement; | ||
const antiforgeryHeaderName: string = root.dataset.epiAntiforgeryHeaderName as string; | ||
const antiforgeryFormFieldName: string = root.dataset.epiAntiforgeryFormFieldName as string; | ||
const xsrfToken = document.getElementsByName( | ||
antiforgeryFormFieldName | ||
)[0] as HTMLInputElement; | ||
const xsrfHeader = { | ||
...axios.defaults.headers, | ||
[antiforgeryHeaderName]: xsrfToken.value, | ||
}; | ||
axios.defaults.headers = xsrfHeader; | ||
|
||
ReactDOM.render(<App />, document.getElementById("root")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/EPiServer.Marketing.Testing.Web/Models/DefaultViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Microsoft.AspNetCore.Antiforgery; | ||
|
||
namespace EPiServer.Marketing.Testing.Web.Models | ||
{ | ||
public class DefaultViewModel | ||
{ | ||
public AntiforgeryOptions AntiforgeryOptions { get; set; } | ||
} | ||
} |