How to make the registration link expire?

When I am creating an admin user, there is this registration link, which has a registrationToken. How can I make it expired after 3 days? I tried this, but it works just on regular token and not on registration token :


{
  "jwt": {
    "expiresIn": "3d"
  }
}

So if I log in and receive a token this expiresIn is working perfectly, but it has no effect on this registrationToken, am I missing something?
Is there any other solution to disable this registration link after 3 days?

P.S: I thought about writing a Cron job, but in the admin user table, there is no created_at field, I know that I can save this created_at somewhere else in the database, but it is not a very clean way to do it.

I honestly have no idea why the heck we didn’t enable timestamps on that model. Short term you can use patch-package and inject

"options": {
    "timestamps": true
  },

On this file: strapi/User.settings.json at master · strapi/strapi · GitHub

And go forward with your cronjob idea (although if you are planning to scale horizontally or vertically you’ll need to go the custom route => external cronjob)

1 Like

Long term I’m going to purpose a PR to enable timestamps on the model as there is no reason why we shouldn’t have them here.

PR created: Add timestamps to the Admin User model by default by derrickmehaffy · Pull Request #10937 · strapi/strapi · GitHub

1 Like