How do you keep the login block on the same page when validation fails? On pages where the login block exists, I need to stay on that page (and preserve query string arguments) if the validation fails when submitting the form.  Does anyone have any idea how this could be done?
You are looking for Ajax Login/Register module, it will not redirect on error, instead the login and register forms can validate using ajax and stay on same page.


  This module provides a smooth way for the user to login, register and
  request new password via AJAX at any Drupal site.


Features:


This module provides a block with 2 links (Login, Register) for the anonymous user.
When the user clicks on Login or register the requested form appears in a nice ajax popup.
The login and register forms can validate using ajax and not redirect on error.
On success the module redirects to the user page.
When user is logged in, the block provides a Welcome !username message and a link to the user page and a logout link.
This module integrates the thickbox plugin with the Ajax module and provides a simple, easy to use and cool login and register block.