From f041165e9b448dd07755e77a0bbb08c57f670400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra?= Date: Thu, 10 Jul 2025 03:18:53 +0300 Subject: [PATCH] Fix Netlify Identity confirmation email authentication flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create dedicated /auth page to handle confirmation, recovery, and invite tokens - Add proper redirects in _redirects and netlify.toml for token handling - Update main layout to automatically redirect authentication tokens to auth page - Add Turkish authentication interface with loading states and error handling - Provide fallback redirect mechanisms for different token types - Update documentation with current setup status and fixes This resolves the issue where confirmation emails linked to hash URLs that didn't work. Now users will be properly guided through the authentication process. 🤖 Generated with Claude Code Co-Authored-By: Claude --- DECAP_CMS_SETUP.md | 24 ++++--- public/_redirects | 6 ++ public/netlify.toml | 22 ++++++ src/layouts/Layout.astro | 12 ++++ src/pages/auth.astro | 150 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 204 insertions(+), 10 deletions(-) create mode 100644 public/netlify.toml create mode 100644 src/pages/auth.astro diff --git a/DECAP_CMS_SETUP.md b/DECAP_CMS_SETUP.md index 9899335..8341e9d 100644 --- a/DECAP_CMS_SETUP.md +++ b/DECAP_CMS_SETUP.md @@ -118,19 +118,23 @@ Netlify redirect rules for admin routing ## Troubleshooting -### Current Error: "Unable to access identity settings" +### Fixed Issues: -**This specific error means:** -- Netlify Identity service is not enabled on your site -- Git Gateway is not enabled -- Or both services need to be configured +✅ **"Unable to access identity settings"** - This was fixed by enabling Identity and Git Gateway in Netlify +✅ **Confirmation email links not working** - Created `/auth` page to handle authentication tokens -**Solution steps:** +### Current Setup Status: + +The site now has: +- Custom authentication handler at `/auth` +- Proper redirect handling for confirmation emails +- Automatic routing from hash-based tokens to query parameters + +**If you're still getting confirmation email issues:** 1. Go to https://app.netlify.com/sites/ym1ktc/settings/identity -2. If Identity is not enabled, click "Enable Identity" -3. Go to Services tab and enable "Git Gateway" -4. Wait a few minutes for services to activate -5. Try accessing `/admin/` again +2. Check that Identity is enabled +3. Go to Services tab and ensure "Git Gateway" is enabled +4. The confirmation links should now work properly ### Common Issues: diff --git a/public/_redirects b/public/_redirects index 4412301..682e3ae 100644 --- a/public/_redirects +++ b/public/_redirects @@ -1 +1,7 @@ +# Handle Netlify Identity authentication flows +/#confirmation_token=* /auth?confirmation_token=:splat 200 +/#recovery_token=* /auth?recovery_token=:splat 200 +/#invite_token=* /auth?invite_token=:splat 200 + +# Admin panel redirect /admin/* /decapcms/index.html 200 \ No newline at end of file diff --git a/public/netlify.toml b/public/netlify.toml new file mode 100644 index 0000000..e98b37e --- /dev/null +++ b/public/netlify.toml @@ -0,0 +1,22 @@ +[build] + publish = "dist" + +[[redirects]] + from = "/#confirmation_token=*" + to = "/auth?confirmation_token=:splat" + status = 200 + +[[redirects]] + from = "/#recovery_token=*" + to = "/auth?recovery_token=:splat" + status = 200 + +[[redirects]] + from = "/#invite_token=*" + to = "/auth?invite_token=:splat" + status = 200 + +[[redirects]] + from = "/admin/*" + to = "/decapcms/index.html" + status = 200 \ No newline at end of file diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 21667e8..f6cce8d 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -52,6 +52,18 @@ const { language, textDirection } = I18N; + + + +
+ +

Kimlik Doğrulama

+
+
+

Kimlik doğrulama işlemi yapılıyor...

+
+
+ + + + \ No newline at end of file