User invitation through mail opens index page, instead of login form asking a password

Hi! I’ve never encountered this problem with my previous projects, and I can’t seem to find a solution.

I have some sites using Gatsby, Netlify-cms and Netlify. They all worked, but not on my latest project.
I have my config.yml correctly set up. I enabled Git-Gatewat en Identity. When I set registration to invite only, and I want to invite myself, I end up having an invite that just sends me to the main page.

I’ve used this method of registration before, and have never encountered this problem until now. I’m not getting any errors as well.

Thanks in advance!

Hi, welcome to the community website!

By default, the netlify identity widget sends you to the root of your website, while your identity widget might live only at /admin/. You could add the identity website to the <head> of your root page, but a cleaner solution might be to change the identity emails: Identity-generated emails | Netlify Docs

I’ve posted Netlify CMS specific templates that you can use here: How to verificate the email? - #4 by tomrutgers

1 Like

Hey Tom! Ow so that’s why. I have gatsby-intl installed, which means I have a site/en/ and a site/nl/ page, while the admin part lives at site/admin. Could that be the issue?

Thank you for your templates. I probably need this one.
<a href="{{ .SiteURL }}/admin/#invite_token={{ .Token }}">

So my follow up question goes as follows: is this the default link, or is it your solution to the problem?
If not, what URL do you think I should use, based on the info given above?

Again thanks in advance!

If you’re only using Netlify Identity to sign up users for the CMS and the Identity Widget only lives at /admin/ I’d advice you to use the templates I posted (which are not the default, which look like this: {{ .SiteURL }}/#invite_token={{ .Token }}

If however, you’re using the Identity Widget for other visitor access related things, you might as well make it available on both your root routes (I’m guessing that’s not the case though :wink:)

Alright! Seems obvious. I’ve been mashing my head over it for some hours now, so I’ll try your solution. I’ll come back if I’ve resolved the issue. Cheers mate!

1 Like

Follow up problem :cry: . When clicking the new invite link, I’m getting redirected to the admin page, but it isn’t clickable, nor is there a popup asking to fill in a new password.
I’m only getting this.

The strange thing is, the button isn’t clickable, like if there’s an invisible layer above it in the DOM. So i checked it and my assumptions where correct.

image
As you can see, there are 2 iframes. Setting the bottom display: none; to display-block; gives me the netlify popup screen as requested.

image

Don’t know if this is a bug, but it could be worth checking out!

1 Like

I assume you’re using the gatsby-plugin-netlify-cms, which includes the identity widget by default. It seems like you also added the netlify identity widget manually. When the identity widget is loaded twice, it stops to work. Try removing the manually added script and try again!

2 Likes

I’m using it indeed! But I’ve never added it elsewhere. In my gatsby-config.js I include the plugin as
'gatsby-plugin-netlify-cms', and that’s it!

I hear you, though the two identity iframes do confirm that the widget is loaded twice. Can you share your repo so we can help you debug the problem?

Sure! Thank you for looking into it.

While I’m going through your repo, it seems you’re loading the identity widget at the root of your site (I see it popping up at your homepage). Could it be that you’re loading it site wide, and then again on your admin page?

Well, not that I know of. I just leave all the default configuration on, (so just importing gatsby-netlify-cms). I never experienced this problem before, even with my other netlify-cms sites using git gateway and netlify identity. Unless I have to specify that in gatsby-config? But again, never had to do that in the past.

But indeed, it never occured to me that I’m loading netlify identity sitewide.

Does adding enableIdentityWidget: false to your gatsby-plugin-netlify-cms options in gatsby-config.js solve your issue? Can't click login button after being logged out. · Issue #3295 · netlify/netlify-cms · GitHub

I’m not exactly a Gatsby expert so someone might jump in with a more reasonable long term solution.

That didn’t do it. I do have a new login screen now:

But the console now gives me this error:

Uncaught ReferenceError: netlifyIdentity is not defined
    at Object.<anonymous> (emitter.js:4)
    at n (bootstrap:19)
    at Object.<anonymous> (mitt.es.js:56)
    at Object.<anonymous> (emitter.js:4)
    at n (bootstrap:19)
    at Object.<anonymous> (cms.js:1)
    at n (bootstrap:19)
    at bootstrap:83
    at cms.js:1

So now the widget isn’t loaded at all.
Edit: The issue you linked is exactly my problem though. But his solution did not work I’m afraid.

Nope, that’s not getting us anywhere! Interesting that the identity widget disappeared from your homepage as well though. @erez or @erquhart might shed some light on this when they can.

1 Like

Well, in the meantime, setting the second widget’s display: none to diplay: block fixed the issue for me. Which is not ideal of course, but it’s something. I’m going to look further into it tomorrow. Again, thank you for your quick answers and help!

1 Like

Meanhile, I’ve put together a post addressing your initial problem: [Common Issue] Netlify CMS & Git Gateway - Email not confirmed

Thanks for your patience, I hope your issue gets fixed soon!

1 Like

Sorry for the late reply, I’ll look into the duplicate iframe, but I forked the repo, ran npm install, then npm run build, npm run serve, went to http://localhost:9000/admin and was able to click the button.

FYI Bug (plugin-netlify-cms): Netlify identity iframe is created twice when using netlify cms plugin · Issue #22386 · gatsbyjs/gatsby · GitHub
And fix(plugin-netlify-cms): use 'netlify-identity.js' instead of 'netlify-identity-widget.js' by erezrokah · Pull Request #22387 · gatsbyjs/gatsby · GitHub

2 Likes

Cheers! Great to see that it has been resolved.

1 Like