Embed a login pop up without redirecting users to the dashboard Completed

I am currently redirecting users to the dashboard upon login. But elsewhere I need to embed a login pop up without redirecting them to the dashboard and stay on the same page with a logged in functionality. How do I achieve this?

Comments

5 comments

  • Comment author
    Duncan from Memberstack
    • Edited
    • Official comment

    🎉 Good news!

    You can now use the attribute data-ms-redirect="current-url" to save the current URL. The next time that visitor goes to sign up or login they will be returned to the page. 

    Here's the full help center article.

  • Comment author
    Julian Galluzzo

    Depending on your use case, you may be able to just duplicate the same page with a pop up pre-opened and then redirect it there

    0
  • Comment author
    Ranjit Sreenivas

    That won't be a good user experience with redirect of the entire page. Can we do it in the background while the pop up is still open using the memberstack API?

    0
  • Comment author
    Julian Galluzzo

    If you prefetch the page the redirect will basically be instant that should work assuming they're both small pages, if they're large then maybe not

    0
  • Comment author
    Chukwudi Onyekwere
    Alternatively, on the page with the login pop-up modal, you can add the script below within the head tags.
    <script>
    window.$memberstackDom.getCurrentMember().then(({ data: member }) => {
      if (member) {
         window.location.href = "LinkToThePageGoesHere";
      } else {
        // do logged out logic here
      }
    })
    </script>
    P.S: In the code snippet above, replace the LinkToThePageGoesHere with the actual link to that page.
    0

Please sign in to leave a comment.