changeset 3503:482098e521ff

plugin misc account: specify domain in new account email sent to admins
author Goffi <goffi@goffi.org>
date Wed, 21 Apr 2021 11:36:26 +0200
parents 6132d363f0e9
children 9f7a867d9722
files sat/plugins/plugin_misc_account.py
diffstat 1 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_account.py	Fri Apr 16 18:33:00 2021 +0200
+++ b/sat/plugins/plugin_misc_account.py	Wed Apr 21 11:36:26 2021 +0200
@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
 
-
-# SAT plugin for account creation (experimental)
+# Libervia plugin for account creation
 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
 
 # This program is free software: you can redistribute it and/or modify
@@ -48,14 +47,14 @@
     C.PI_RECOMMENDATIONS: ["GROUPBLOG"],
     C.PI_MAIN: "MiscAccount",
     C.PI_HANDLER: "no",
-    C.PI_DESCRIPTION: _("""SàT account creation"""),
+    C.PI_DESCRIPTION: _("""Libervia account creation"""),
 }
 
 CONFIG_SECTION = "plugin account"
 
 # You need do adapt the following consts to your server
-# all theses values (key=option name, value=default) can (and should) be overriden in sat.conf
-# in section CONFIG_SECTION
+# all theses values (key=option name, value=default) can (and should) be overriden
+# in libervia.conf in section CONFIG_SECTION
 
 default_conf = {
     "email_from": "NOREPLY@example.net",
@@ -306,16 +305,14 @@
         admins_emails = self.getConfig("email_admins_list")
         if not admins_emails:
             log.warning(
-                "No known admin email, we can't send email to administrator(s).\nPlease fill email_admins_list parameter"
+                "No known admin email, we can't send email to administrator(s).\n"
+                "Please fill email_admins_list parameter"
             )
             d_admin = defer.fail(exceptions.DataError("no admin email"))
         else:
             subject = _("New Libervia account created")
-            body = """New account created: {profile} [{email}]""".format(
-                profile=profile,
-                # there is no email when an existing XMPP account is used
-                email=email or "<no email>",
-            )
+            # there is no email when an existing XMPP account is used
+            body = f"New account created on {domain}: {profile} [{email or '<no email>'}]"
             d_admin = sat_email.sendEmail(
                 self.host.memory.config, admins_emails, subject, body)