# HG changeset patch # User Goffi # Date 1618997786 -7200 # Node ID 482098e521ff140d2afba675b20cbdf0bd09fed9 # Parent 6132d363f0e9b3607ce928a7ae5eb757be76f0b2 plugin misc account: specify domain in new account email sent to admins diff -r 6132d363f0e9 -r 482098e521ff sat/plugins/plugin_misc_account.py --- 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 "", - ) + # there is no email when an existing XMPP account is used + body = f"New account created on {domain}: {profile} [{email or ''}]" d_admin = sat_email.sendEmail( self.host.memory.config, admins_emails, subject, body)