complete login functionality