Fix log-in issue.

Log-in should forward to referrer page except when reffered by log-out.