implemented login logic