Improve login ajax behaviour