finish login logic