I'm very short of time at the moment. From a requirement perspective, the desired behavior is the following:

* Using the login dialog from within an overlay means this overlay has been triggered by a link/button with a `href` target (e.g. to `/proposal/new`). After successful login, the user should end up in there `/proposal/new`, and not on the page s/he last visited or the instance overview page. Previously, this has been done by the javascript function `adhocracy.overlay.rebindCameFrom` (in `adhocracy.js`), which patches the link to `/login` with a `came_from` query string. This doesn't work anymore, as we/you now show the login form directly in the overlay. To achieve the same effect, the post-login target URL could be stored in a hidden field set by the (modified) javascript function.

* Using the login dialog normally (not in an overlay) should take into account a query string `came_from=xxx` (as it was before), and use the session (or another mechanism, such as the hidden field as above) to store the target and redirect to that after successful login.

* The information shouldn't be lost (in either of the two cases above) if a validation error occured.

* The information shouldn't be lost (in either of the two cases above) if the user clicks on `register` (and back) from within the login form.

I think that not all of the above works properly, but it'd be great to fix this and at least not to introduce more cases in which the proper redirection doesn't work anymore. Sorry for being nitpicky about that, but I think it's quite a showstopper if you're interrupted in order to log in but don't end up where you originally wanted to end up. Thanks for fixing!!

That's roughly how it should behave - the exact implementation is up to you ;)