Client side login logic