header login logic