implement some login functions