Controlling login flow