added login function that triggers a login