Make redirect to previous page after login or logout