moved login to js