]> git.ipfire.org Git - ipfire.org.git/commitdiff
people: Send email to admin@ipfire.org for new account registrations
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Sep 2019 18:19:13 +0000 (19:19 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Sep 2019 18:19:13 +0000 (19:19 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/backend/accounts.py
src/templates/people/messages/new-account.txt [new file with mode: 0644]

index eef9578e6fe0e4a36f2dc1a849af8239fb4dc751..4d645ccf80777f72f3e5b8546c844931a1285417 100644 (file)
@@ -237,6 +237,11 @@ templates_people_DATA = \
 
 templates_peopledir = $(templatesdir)/people
 
+templates_people_messages_DATA = \
+       src/templates/people/messages/new-account.txt
+
+templates_people_messagesdir = $(templates_peopledir)/messages
+
 templates_people_modules_DATA = \
        src/templates/people/modules/accounts-list.html \
        src/templates/people/modules/accounts-new.html \
index 1c348a2a639374b0da27c22e3e835eb6db8dcaae..d79c21126a7dfc7051c10c6bd8eb331fc362a86e 100644 (file)
@@ -209,9 +209,15 @@ class Accounts(Object):
                        return
 
                # Create a new account on the LDAP database
-               return self.create(uid, res.email,
+               account = self.create(uid, res.email,
                        first_name=res.first_name, last_name=res.last_name)
 
+               # Send email about account registration
+               self.backend.messages.send_template("people/messages/new-account",
+                       recipients=["admin@ipfire.org"], account=account)
+
+               return account
+
        def create(self, uid, email, first_name, last_name):
                cn = "%s %s" % (first_name, last_name)
 
diff --git a/src/templates/people/messages/new-account.txt b/src/templates/people/messages/new-account.txt
new file mode 100644 (file)
index 0000000..fe7973f
--- /dev/null
@@ -0,0 +1,14 @@
+From: IPFire Project <no-reply@ipfire.org>
+Subject: {{ _("New Account Registered: %s") % account }}
+
+{{ _("Hello,") }}
+
+{{ _("a new account has been registered:") }}
+
+* {{ _("UID: %s") % account.uid }}
+* {{ _("Name: %s") % account }}
+* {{ _("Email: %s") % account.email }}
+
+{{ _("More can be found here:") }}
+
+  https://people.ipfire.org/users/{{ account.uid }}