finish login functionality