Added redirecting to previous page on login.