Revert "Added integrity token to signup-form package"

ref https://github.com/TryGhost/Ghost/issues/21527
- This reverts commit ebc87002ce
- commit ebc87002ce is a breaking change, and should not have been released as a signup-form patch release (0.1.x)
This commit is contained in:
Sag 2024-11-12 10:57:22 +08:00
parent 174b13982a
commit 4107646cc5
4 changed files with 3 additions and 32 deletions

View File

@ -45,13 +45,6 @@ const Preview: React.FC<SignupFormOptions & {
}
return;
},
getIntegrityToken: async () => {
await new Promise((resolve) => {
setTimeout(resolve, 500);
});
return 'testtoken';
}
},
t: i18n.t,

View File

@ -21,8 +21,7 @@ export const FormPage: React.FC = () => {
setLoading(true);
try {
const integrityToken = await api.getIntegrityToken();
await api.sendMagicLink({email, labels: options.labels, integrityToken});
await api.sendMagicLink({email, labels: options.labels});
if (minimal) {
// Don't go to the success page, but show the success state in the form

View File

@ -12,31 +12,14 @@ export const setupGhostApi = ({siteUrl}: {siteUrl: string}) => {
}
return {
getIntegrityToken: async (): Promise<string> => {
const url = endpointFor({type: 'members', resource: 'integrity-token'});
const response = await fetch(url, {
headers: {
'app-pragma': 'no-cache',
'x-ghost-version': '5.90'
}
});
if (response.status < 200 || response.status >= 300) {
throw new Error(response.statusText);
}
return response.text();
},
sendMagicLink: async ({email, integrityToken, labels}: {email: string, labels: string[], integrityToken: string}) => {
sendMagicLink: async ({email, labels}: {email: string, labels: string[]}) => {
const url = endpointFor({type: 'members', resource: 'send-magic-link'});
const payload = JSON.stringify({
email,
emailType: 'signup',
labels,
urlHistory: getUrlHistory({siteUrl}),
integrityToken
urlHistory: getUrlHistory({siteUrl})
});
const response = await fetch(url, {

View File

@ -65,9 +65,5 @@ export async function mockApi({page, status = 200}: {page: any, status?: number}
await route.abort('addressunreachable');
});
await page.route(`${MOCKED_SITE_URL}/members/api/integrity-token/`, async (route) => {
await route.fulfill('testtoken');
});
return lastApiRequest;
}