Mercurial > libervia-backend
comparison libervia/backend/plugins/plugin_misc_account.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children | e9971a4b0627 |
comparison
equal
deleted
inserted
replaced
4269:64a85ce8be70 | 4270:0d7bb4df2343 |
---|---|
312 else: | 312 else: |
313 subject = _("New Libervia account created") | 313 subject = _("New Libervia account created") |
314 # there is no email when an existing XMPP account is used | 314 # there is no email when an existing XMPP account is used |
315 body = f"New account created on {domain}: {profile} [{email or '<no email>'}]" | 315 body = f"New account created on {domain}: {profile} [{email or '<no email>'}]" |
316 d_admin = sat_email.send_email( | 316 d_admin = sat_email.send_email( |
317 self.host.memory.config, admins_emails, subject, body) | 317 self.host.memory.config, admins_emails, subject, body |
318 ) | |
318 | 319 |
319 admins_emails_txt = ", ".join(["<" + addr + ">" for addr in admins_emails]) | 320 admins_emails_txt = ", ".join(["<" + addr + ">" for addr in admins_emails]) |
320 d_admin.addCallbacks( | 321 d_admin.addCallbacks( |
321 lambda __: log.debug( | 322 lambda __: log.debug( |
322 "Account creation notification sent to admin(s) {}".format( | 323 "Account creation notification sent to admin(s) {}".format( |
346 d_user.addCallbacks( | 347 d_user.addCallbacks( |
347 lambda __: log.debug( | 348 lambda __: log.debug( |
348 "Account creation confirmation sent to <{}>".format(email) | 349 "Account creation confirmation sent to <{}>".format(email) |
349 ), | 350 ), |
350 self._send_email_eb, | 351 self._send_email_eb, |
351 errbackArgs=[email] | 352 errbackArgs=[email], |
352 ) | 353 ) |
353 return defer.DeferredList([d_user, d_admin]) | 354 return defer.DeferredList([d_user, d_admin]) |
354 | 355 |
355 def account_domain_new_get(self): | 356 def account_domain_new_get(self): |
356 """get the domain that will be set to new account""" | 357 """get the domain that will be set to new account""" |
741 | 742 |
742 d = self.create_profile(password, jid_s, jid_s) | 743 d = self.create_profile(password, jid_s, jid_s) |
743 d.addCallback( | 744 d.addCallback( |
744 lambda __: self.host.memory.get_profile_name(jid_s) | 745 lambda __: self.host.memory.get_profile_name(jid_s) |
745 ) # checks if the profile has been successfuly created | 746 ) # checks if the profile has been successfuly created |
746 d.addCallback(lambda profile: defer.ensureDeferred( | 747 d.addCallback( |
747 self.host.connect(profile, password, {}, 0))) | 748 lambda profile: defer.ensureDeferred( |
749 self.host.connect(profile, password, {}, 0) | |
750 ) | |
751 ) | |
748 | 752 |
749 def connected(result): | 753 def connected(result): |
750 self.send_emails(None, profile=jid_s) | 754 self.send_emails(None, profile=jid_s) |
751 return result | 755 return result |
752 | 756 |
753 def remove_profile( | 757 def remove_profile( |
754 failure | 758 failure, |
755 ): # profile has been successfully created but the XMPP credentials are wrong! | 759 ): # profile has been successfully created but the XMPP credentials are wrong! |
756 log.debug( | 760 log.debug( |
757 "Removing previously auto-created profile: %s" % failure.getErrorMessage() | 761 "Removing previously auto-created profile: %s" % failure.getErrorMessage() |
758 ) | 762 ) |
759 self.host.memory.profile_delete_async(jid_s) | 763 self.host.memory.profile_delete_async(jid_s) |