Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/reader-activation-auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ window.newspackRAS.push( readerActivation => {
ev.preventDefault();
const modalTrigger = ev.target;
let callback, redirect;

// Check ancestors to see if we're signing in to an existing account.
const isExistingAccountFlow = Boolean( modalTrigger.closest( '.newspack-registration__have-account' ) );

if ( ev.target.getAttribute( 'data-redirect' ) ) {
redirect = ev.target.getAttribute( 'data-redirect' );
} else {
Expand All @@ -62,7 +66,9 @@ window.newspackRAS.push( readerActivation => {
}
}
}
if ( redirect && redirect !== '#' ) {

// If we're in a modal, ignore redirect so 'Continue' dismisses it and reader can continue on the current page.
if ( redirect && redirect !== '#' && ! isExistingAccountFlow ) {
callback = () => {
window.location.href = redirect;
};
Expand Down
Loading