Change the url component in the code( from https://my-url.com to your url) and apply the code to Page Settings>Custom Code>Header section and enjoy
<script >
function handleRedirect() {
var elem = document.querySelectorAll('button[type=submit]')[0];
if (!elem) {
return;
}
window.setInterval(function() {
if (elem.querySelector('.success-icon')) {
const redirectUrl = `https://my-url.com`;
setTimeout(() => {
window.location.href = redirectUrl;
}, 2000);
}
}, 500);
}
window.addEventListener('block-loaded-user-accounts1', () => {
handleRedirect();
});
</script>