Adding option to automatically close the dialog after login