Logic to control log ins.