PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / src / DonationForms / resources / app / utilities / authToken.ts

authToken.ts in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at src/DonationForms/resources/app/utilities/authToken.ts

25 lines 824 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * The auth token the authentication route returns after a successful login.
3 *
4 * Inside a cross-site iframe the browser drops the WordPress login cookie, so
5 * this token is what keeps the donor signed in for the validate and donate
6 * requests. It is request transport, not form data: keeping it out of the form
7 * values keeps it out of the client-side validation schema, which rejects keys
8 * it does not know.
9 *
10 * It lives on window.givewp.form because the login template and the form app
11 * ship in separate bundles, so module state would not be shared between them.
12 *
13 * @since 4.17.0
14 */
15 export function setAuthToken(token: string): void {
16 window.givewp.form.authToken = token ?? '';
17 }
18
19 /**
20 * @since 4.17.0
21 */
22 export function getAuthToken(): string {
23 return window.givewp?.form?.authToken ?? '';
24 }
25