mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Fixed token handling in url for magic-link
closes https://github.com/TryGhost/members.js/issues/14 This adds handling of url update when signing-in with magic link by removing the token query param, which can cause accidental re-login on refresh.
This commit is contained in:
parent
72b8a376c6
commit
1fdc514c1f
1 changed files with 9 additions and 0 deletions
|
@ -9,8 +9,17 @@ function addRootDiv() {
|
|||
document.body.appendChild(elem);
|
||||
}
|
||||
|
||||
function handleTokenUrl() {
|
||||
const url = new URL(window.location);
|
||||
if (url.searchParams.get('token')) {
|
||||
url.searchParams.delete('token');
|
||||
window.history.replaceState({}, document.title, url.href);
|
||||
}
|
||||
}
|
||||
|
||||
function init(data) {
|
||||
addRootDiv();
|
||||
handleTokenUrl();
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App data={data} />
|
||||
|
|
Loading…
Add table
Reference in a new issue