initial login logic copied in

please pull