Added custom action param for magic links

closes https://github.com/TryGhost/Ghost/issues/12253

- Allows using custom action param for requests from Portal by using a new `requestSrc` option that is passed down when a request for magic link is made via Portal
This commit is contained in:
Rish 2020-10-28 18:21:09 +05:30 committed by Rishabh Garg
parent 6e82934230
commit 746ccbd7ed

View File

@ -237,12 +237,13 @@ class MembersConfigProvider {
};
}
getSigninURL(token, type) {
getSigninURL(token, type, requestSrc) {
const siteUrl = this._urlUtils.getSiteUrl();
const signinURL = new URL(siteUrl);
signinURL.pathname = path.join(signinURL.pathname, '/members/');
const actionParam = requestSrc === 'portal' ? 'portal-action' : 'action';
signinURL.searchParams.set('token', token);
signinURL.searchParams.set('action', type);
signinURL.searchParams.set(actionParam, type);
return signinURL.href;
}
}