waltzio/waltz — pull request #88 by landakram (2013-11-26 19:47:58+00:00)
Title: Stores original URL and redirects after a successful login

This PR will redirect you back to the original page you were viewing before you hit the Waltz button.

The redirect will not happen in certain cases:

1. The URL the browser would have navigated to is the login URL. If this is the case, there was most likely an error with the login request (of course, this is a rough heuristic that may not always be true).
2. The original URL is the login URL. If this is the case, it's likely that the site will already redirect the user to where they need to be (perhaps using referer or something), so we let the site handle that instead.

This PR does not give consideration to two-factor or other additional screens—those will be handled in a different PR.