8000 Default email template doesn’t have /admin (Netlify CMS) · Issue #62 · cstate/cstate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Default email template doesn’t have /admin (Netlify CMS) #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pauby opened this issue Mar 18, 2019 · 17 comments
Closed

Default email template doesn’t have /admin (Netlify CMS) #62

pauby opened this issue Mar 18, 2019 · 17 comments
Labels

Comments

@pauby
Copy link
Contributor
pauby commented Mar 18, 2019

Describe the bug
I cannot get access to the /admin page through Netlify

Reproduction steps
Steps to reproduce the behavior:

  1. Setup site in Netlify (set works well, I make a commit and it updates the site, I have setup a custom domain name, custom SSL and works well)
  2. Invite myself as a user
  3. Click on the 'Accept invite' link in the email.
  4. When I see the site it has a #invite_token in the URL
  5. I then go to site/admin and get the Login to Netlify button
  6. Click the button and I'm asked to provide a username and password. I enter my email address and a password (note the password I enter I'm assuming I'm setting as nowhere has given me a password or let me set one up to this point). I get the error 'Email not confirmed';
  7. If I click the 'Login to Netlify'; button again and click 'Recover password' and enter my email address I'm sent a link by email.
  8. If I click this link I geta url with #recovery_token after it but again nowehere to set an email.
  9. This just goes around and around. I cannot login. Tried two different browsers (Firefox and Chromium);

I also triued adding the Gitlab provider but it does the same (without the username and password box).

I tried to setup cState in Netlify about 6 months ago (version 2) and had EXACTLY the same issues and gave up.

I'm not sure where the issue lies. If it were a Netlify issue they'd have fixed it. If this was a cState issue, there would be issues raised about it. So is it me? Perhaps but I've been through this so many times that I'm lost as to what the issue actually is.

Expected behavior
I can log in.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chromium and Firefox
  • Version Chromium - 73.0.3683.75 (Official Build) (64-bit) and Firefox - 65.0.2 (64-bit)
@mistermantas
Copy link
Member

Sorry to hear about that! Here are some preliminary thoughts:

Indeed Netlify CMS login is a bit finicky, however, from v3 onwards I had implemented a different behavior for those email links.

Because, by default, Netlify sends emails like this: example.com/#invite_token

but the links should have a URL like this: example.com/admin/#invite_token

That is the one issue I recall being very pertinent.

Another point: have you tried using SSO? It should be much easier than the username/password workflow?

Because as far as I understand, you just haven't set up a password which is why you can't login.

@pauby
Copy link
Contributor Author
pauby commented Mar 19, 2019

Another point: have you tried using SSO? It should be much easier than the username/password workflow?

I actually tried that first but it went through the authorisation process (enter creds into popup Gitlab window) and then went back to the main web page. Going to /admin just puts you back to the button to Login to Netlify and back through that authorisation loop.

but the links should have a URL like this: example.com/admin/#invite_token

The links sent via email don't have the /admin in there (I actually copied and pasted the links in case they were getting mangled somehow). So that would suggest a cState issue perhaps? Not looking to point the finger, looking to get a pointer on the issue so we can fix it.

Because as far as I understand, you just haven't set up a password which is why you can't login.

The issue is there is no way to set a password because it says I haven't confirmed my email. I'm assuming when I do that I'll get a nice box asking me for a password.

Netlify seems nice but getting this working within it (my experiences aside, based more on your comments and what I've read in this repo).

As an aside, is prose.io an easier proposition (although it doesn't do the hosting)?

@mistermantas
Copy link
Member

The links sent via email don’t have the /admin in there

They should. They don’t. That’s the issue with them.

Everything must happen within the /admin URLs.

As an aside, is prose.io an easier proposition (although it doesn’t do the hosting)?

GitHub only though. GitHub does the hosting.

@pauby
Copy link
Contributor Author
pauby commented Mar 19, 2019

They should. They don’t. That’s the issue with them.

Is that a cState issue or a Netlify one? The email link that arrives looks like this:

https://mandrillapp.com/track/click/30002868/website.something.com?p=eyJzIjoieFd0M0RsY1l0NU50ckxOb0o0UGMSwicCI6IntcInVcIjozMDAwMjg2OCxcInZcIjoxLFwidXJsXCI6XCJoddsd335fdfvXFxcL3N0YXR1c3BhZ2UuY2hvY2lRTG5pb0c5b1NnXCIsXCJpZFwiOlwiMTMzZmM3NjVjOWUwNGE4Mzk0YjVmNTliM2UxN2Y3YTNcIixcInVybF9pZHNc

(that's not a real link) so once that resolves to /#invite_token I amend it to /admin/#invite_token and I was prompted to set a password. So I'm in. Will see what I can and cannot do.

Will also now look at setting up the Gitlab provider.

GitHub only though. GitHub does the hosting.

Ah. No use then sadly.

@mistermantas
Copy link
Member

Do you have JS on?

@mistermantas
Copy link
Member

To explain a bit better - I believe I added a JS redirect in v3 for those links without /admin

@mistermantas mistermantas changed the title Cannot get Netlify to work Cannot get Netlify CMS to work Mar 20, 2019
@pauby
Copy link
Contributor Author
pauby commented Mar 20, 2019

Do you have JS on?
To explain a bit better - I believe I added a JS redirect in v3 for those links without /admin

I'll give you the long explanation 😄 I have two browsers - Firefox which is locked down with uBlock Origin and uMatrix. That needs JS turned on for sites. That's why I use Chromium as it is straight out of the box so JS is on. That's what I use for this at the moment to make sure I'm ruling out issues such as JS or other 'site parts' that uMatrix will block in Firefox.

What I did as copy the link from the email and paste it in Chromium.

@mistermantas
Copy link
Member

Okay so the JavaScript isn't working. I'll look into getting the Netlify template emails fixed

@pauby
Copy link
Contributor Author
pauby commented Mar 20, 2019

Awesome.

@mistermantas mistermantas changed the title Cannot get Netlify CMS to work Default email template doesn’t have /admin (Netlify CMS) Mar 20, 2019
@mistermantas
Copy link
Member

Crap. There’s no way to do this by default.

@pauby
Copy link
Contributor Author
pauby commented Mar 20, 2019

Does this not say you can:

Invite: {{ .SiteURL }}/some/path/#invite_token={{ .Token }}

So you could have Invite: {{ .SiteURL }}/admin/#invite_token={{ .Token }}

I feel this is too easy and you know it better than I so I'm assuming not?

@mistermantas
Copy link
Member

relevant bit:

All Identity-generated emails have basic templates built in, but you may customize them by creating new templates and saving them to your site repository, then specifying the path to the template in Settings > Identity > Emails.

@pauby
Copy link
Contributor Author
pauby commented Mar 20, 2019

(bear in mind this is new to me so apologies if this is dumb)

So you can't set the email templates by default. However when setting up the site on Netlify the user can add those templates if you provide them? So that would just be another step(s) in the setitng up with Netlify instructions here:

image

@mistermantas
Copy link
Member

sort of yes

that + there would be a migration (except this isn't critical functionality but anyway) guide for people on the older versions

it's feasible but not a pretty solution which is what I would love to have

@mistermantas
Copy link
Member

I sent an email to Netlify about this - will implement manual email templates for now

@pauby
Copy link
8000
Contributor Author
pauby commented Mar 20, 2019

At least there is a relatively painless workaround.

@mistermantas
Copy link
Member

Oh, actually Netlify at some point changed the URL hash from access_token to invite_token, recovery_token, etc.

I’ve tweaked the JS to reflect this (plus keep the old token hash in case other people use the older versions):

  if (window.location.hash.match('access_token')) {
    document.location.pathname = '/admin';
  }
  if (window.location.hash.match('invite_token')) {
    document.location.pathname = '/admin';
  }
  if (window.location.hash.match('confirmation_token')) {
    document.location.pathname = '/admin';
  }
  if (window.location.hash.match('email_change_token')) {
    document.location.pathname = '/admin';
  }
  if (window.location.hash.match('recovery_token')) {
    document.location.pathname = '/admin';
  }

I’ve also added the better email templates so there’s two choices now: proactive (if you add many users or are just neat like that) + this automatic JS redirect.

mistermantas added a commit that referenced this issue Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0