Include all required scripts for notifying the admin of Gitea new users

master
sigonasr2 2 years ago
commit 96ebf27566
  1. 10
      checkregistration.sh
  2. 14
      notifyregistration.sh
  3. 1
      registeredusers.data

@ -0,0 +1,10 @@
cd /home/sigonasr2/GiteaMailNotifications
CURRENT=$(curl -s -D - -o /dev/null 'http://sig.projectdivar.com/api/v1/admin/users' -H 'accept: application/json' -H 'authorization: Basic $(cat .APIKEY)' | grep "X-Total-Count:")
PREVIOUS=$(cat registeredusers.data)
if [ "$CURRENT" != "$PREVIOUS" ]; then
./notifyregistration.sh
echo $CURRENT > registeredusers.data
echo "New registration detected. Email sent"
else
echo "No new users detected."
fi

@ -0,0 +1,14 @@
#!/bin/sh
# sendmail command line optons:
# -i - do not treat lines starting with dot specially
# -t - read recipients lists from message headers: TO,CC,BCC
# -v - use verbose mode (describe what is happening)
/usr/sbin/sendmail -i -t << MESSAGE_END
From: Sig <sigonasr2@projectdivar.com>
To: sigonasr2@yahoo.com
Date: Fri, 5 Aug 2022 10:44:00 -0700
Subject: Gitea - New User Registration!
A new user has registered on your site. You can go approve them now.
Loading…
Cancel
Save