Log in functionality and redirects for authorization