mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
Revert "Added integrity token to signup-form package"
ref https://github.com/TryGhost/Ghost/issues/21527 - This reverts commitebc87002ce
- commitebc87002ce
is a breaking change, and should not have been released as a signup-form patch release (0.1.x)
This commit is contained in:
parent
174b13982a
commit
4107646cc5
@ -45,13 +45,6 @@ const Preview: React.FC<SignupFormOptions & {
|
||||
}
|
||||
|
||||
return;
|
||||
},
|
||||
getIntegrityToken: async () => {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
});
|
||||
|
||||
return 'testtoken';
|
||||
}
|
||||
},
|
||||
t: i18n.t,
|
||||
|
@ -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
|
||||
|
@ -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, {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user