Changed login to work with javascript