created a login function