Auto expiring user accounts


I am working on a project that requires the creation of users that will be able to access parts of a website by logging in via the front end. The user account should auto expire after a certain amount of days.

Any ideas on how to implement that feature with Kirby?

Thanks in advance

You could implement a cron job that deletes user accounts based on expiry date.

Thanks. This could be a straightforward solution but I guess it will just behave as if the user account never existed once it expires. It would be nice to be able to give a custom message e.g.“Your account has expired”.

You could define a read only field in the blueprint for the user role ( and then auto populate it via some hook ( with a value like 30 days in future from now on. Then just change the validation of the login process and deny the login if the value (the date) in the user blueprint expires.

I can’t give a working example because I’m myself too unfamiliar with this but this is most likely a clean and good solution :).

1 Like

In Kirby 3.2 you can createuser models, so you could in fact override the login method in your model and then act depending on the value stored in the user’s expiry field.

1 Like