Newsletter Activation Link

Hey dear ghost people,

I am using the Beta Newsletter Feature on my site.
Everything works great, except one bug has been brought up to me:
After clicking the submit button, the user receives an email with a link. It says that you need to click on that link within 10 minutes. If you click within that 10 minutes, everything is fine. But if you click on that link after 10 minutes, you get to the website saying: “great youre a member!”, but the user was actually not added to the newsletter-list in the admin menu.

My Questions:
1.) Can I deactivate the 10 minutes time or at least make in longer (say, 24 hours)?
2.) Is this an overall bug or does it happen only in my setup?

Using Ghost 3.13.4 on “liebling” theme (0.6.9 - latest).

Thany you very much in advance!

Hi @lawyered.at,

  1. yes, you can change the expiration time for login link:
  • Open index.js found at /var/www/ghost/versions/3.13.1/node_modules/@tryghost/magic-link/index.js

  • Search for 4 arguments expiresIn: '10m' (10m stands for 10 minutes)

  • Change all 4 arguments in the file to new expiration time
    Formats:
    1h=1Hours
    1d=1Day
    1y=1Year

  • Restart ghost

  1. i think ghost doesnt check if the link is still valid when it displays the notification bar, so no bug on your end, but definitely something that should be added in the future.
2 Likes

Hey @daniel1,
thank you very much, this works just fine!

But there is still one problem left: the text in the email didn’t change. It still says 10 minutes even though the link expires after a few days…

Do you know where I could change the text?

Hey @lawyered.at,

glad it worked.
Sure thing:
path: var/www/ghost/versions/3.13.1/core/server/services/members/emails/*
Change text about expiration time (at Line 129) in:
signin.js
signup.js
subscribe.js

They are the template files for your transactional emails, when someone signs up, signs in or subscribes.

2 Likes

@daniel1, you are the best.
You solved my problem completely, now I can even translate the mails to german, thank you very much!

2 Likes

I am using Ghost with Digital Ocean. Where can I find that folder? Or is it available on the theme itself?

Hi @amiamigo97,
i’m afraid that’s only possible for self-hosted ghost installation,
as you have to be able to edit the root folder of ghost, which you can’t on the hosted version of ghost. afaik

1 Like

Yes! I have self-hosted mine using Digital Ocean. But where do I find the installation files to edit the folder?

Oh, i totally misread your comment.
You can access your server via ssh or sftp and edit the files under following path:
/var/www/ghost/versions/3.36.0/core/server/services/members/emails

1 Like

Thanks @daniel1, However one thing is still not clear. Have you used Digital Ocean before? How can that folder be accessed? As in where exactly will I put that path you gave? Because the whole idea is for me to be able to edit the files contained in the folder…now how do I get the folder…? Or how do I download it since I have no idea where exactly to get it? And how will I be able to use my code editor i.e WebStorm to edit those files then update Ghost again? If this was just normal cPanel…I would go straight to FTP and access it through the File Manager…Do you have an idea of how I can do that through Digital Ocean and their droplets?

Hi @amiamigo97,
here’s a step-by-step guide:

Updating files via FTP

  1. Download FTP client of choice (i’d recommend WinSCP if you’re on windows)
  2. Create new site in your ftp client:
  • File protocol: SFTP
  • Host name = your droplet IP
  • port = 22
  • user name = root
  • password = root password you defined on droplet creation (option A)
  • ssh key = SSH key you defined on droplet creation (option B)
    if you want to connect with an ssh key, you have to let your ftp client know where to find the ssh file (in winscp you’ll select it under Advanced - SSH - Authentication - Private key file:)
  1. Save Site and Login
  2. Now depending on your layout choice during setup of ftp client you’ll find yourself in some sort of explorer starting with / <root> at the top. From there on simply navigate your way down to the desired path.
  3. You should be able to drag-drop files in and out of the ftp client, modify them accordingly in your desired editor and drag them back in

Connecting via SSH

  1. Download a Terminal (if not preinstalled on your system)
  2. Open terminal and ssh into your server via cmd:
  • ssh yourdropletIP

Connecting via SSH directly in WebStorm
Most up-to-date editors have the capability to open an ssh tunnel in the editor itself.
I’d recommend following the official documentation for WebStorm:

Important!

  • in order for changes to take effect, you have to restart the ghost instance with following commands:
  • sudo -i -u ghost-mgr change to ghost user
  • cd /var/www/ghost/ change directory to ghost installation folder
  • ghost restart restart ghost

Hi @daniel1, Thanks so much for your thoroughly walk-through. That’s the closest that has gotten me to make those changes. I am so surprised why Ghost would do that…At least they should give us an option to choose an expiration time. Because of so much hassle I have decided to use Convert-kit for subscription. And Digital Ocean too should make it easier for us to access those root folders.

Glad to be of help.

You can also access your droplet directly via the console in the digital ocean dashboard:

The email templating is part of ghosts core files. Core files, unlike your theme files, get replaced on every ghost update. So in order to keep your changes you have to edit relevant core files after every update.

You can definitely mention that as a feature request.

File Manager seems nice, but i doubt it’s a high priority for DO, as most of their customers connect to their servers via ssh, ftp etc. anyway.