finished login logic