Skip to content
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

Automatically delete users account requests in stage "pending email approval". after X days #555

Open
roadn opened this issue Nov 29, 2024 · 5 comments

Comments

@roadn
Copy link

roadn commented Nov 29, 2024

No description provided.

@BobLamarley
Copy link
Contributor

Do you want a bash script with a crontab that you launch background and do this job ?

@roadn
Copy link
Author

roadn commented Dec 30, 2024

Do you want a bash script with a crontab that you launch background and do this job ?

yes . Thank you. With email notification

BobLamarley added a commit to BobLamarley/genouestaccountmanager that referenced this issue Dec 30, 2024
@BobLamarley
Copy link
Contributor

Email notification to who ? The admin with a summary of all users deleted ? To each users himself ? To admin + users ?

@roadn
Copy link
Author

roadn commented Dec 30, 2024

To admin + users

@BobLamarley
Copy link
Contributor

BobLamarley commented Dec 30, 2024

What I’ve done:

  • The script searches for all users who have been in the “pending approval” status for more than the specified number of days (provided via the command argument).
  • It sends an email to each affected user and a single summary email to the admin, listing all the users who were deleted.

Key Details:

  • This is a Node.js script rather than a Bash script, as it leverages maisrv functions to send emails.

  • To run the script, you’ll need to set the NODE_CONFIG_DIR environment variable to point to the configuration directory:

    export NODE_CONFIG_DIR=path/to/config
  • Usage: To run the script manually, use the following command:

    node delete_pending_email_approvals.js --days 30
  • Scheduling: You can also schedule this script using cron. For example, to run it every minute:

    * * * * * /path/to/node /path/to/delete_pending_email_approvals.js --days 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants