From 994fe58babb207642757eda814af8b07749777af Mon Sep 17 00:00:00 2001
From: Eloi Perdereau <eloi@perdereau.eu>
Date: Fri, 27 Nov 2020 20:29:22 +0100
Subject: [PATCH] add mailchimp script to default layout head

---
 _includes/scripts.html |  1 +
 _layouts/default.html  |  1 +
 lepuget/index.html     | 11 +++++++++++
 3 files changed, 13 insertions(+)

diff --git a/_includes/scripts.html b/_includes/scripts.html
index 63dbe63..9179a8e 100644
--- a/_includes/scripts.html
+++ b/_includes/scripts.html
@@ -55,3 +55,4 @@
     });
   }
 </script>
+
diff --git a/_layouts/default.html b/_layouts/default.html
index 34c4e3f..b86a5a4 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -12,6 +12,7 @@
   <head>
     {% include head.html %}
     {% include head/custom.html %}
+<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/dde8bfc315d8dddb954801cda/55de9db113fb08c0f5887f632.js");</script>
   </head>
 
   <body class="layout--{{ page.layout | default: layout.layout }}{% if page.classes or layout.classes %}{{ page.classes | default: layout.classes | join: ' ' | prepend: ' ' }}{% endif %}">
diff --git a/lepuget/index.html b/lepuget/index.html
index e0a2130..2e93a6c 100644
--- a/lepuget/index.html
+++ b/lepuget/index.html
@@ -10,6 +10,17 @@
   <body>
     <script>
         window.netlifyIdentity.setLocale("fr");
+
+        window.netlifyIdentity.on("init", user => {
+            console.log("netlify init! ###################### " + user.email);
+            if (user && user.email == "jardin.contact@luminy.org")
+                window.netlifyIdentity.logout().then( (err) => {
+                    console.log(user.email + " déconnecté!");
+                    document.location.href = "/";
+                });
+            if (!user) {
+            }
+        });
     </script>
     <!-- Include the script that builds the page and powers Netlify CMS -->
     <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
-- 
GitLab