Unable to properly implement login