diff options
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/account_validity.py | 19 | ||||
-rw-r--r-- | synapse/handlers/deactivate_account.py | 2 |
2 files changed, 14 insertions, 7 deletions
diff --git a/synapse/handlers/account_validity.py b/synapse/handlers/account_validity.py index 664d09da1c..65eb0735fd 100644 --- a/synapse/handlers/account_validity.py +++ b/synapse/handlers/account_validity.py @@ -40,11 +40,18 @@ class AccountValidityHandler: self.sendmail = self.hs.get_sendmail() self.clock = self.hs.get_clock() - self._account_validity = self.hs.config.account_validity + self._account_validity_period = self.hs.config.account_validity_period + self._account_validity_enabled = self.hs.config.account_validity_enabled + self._account_validity_renew_email_subject = ( + self.hs.config.account_validity_renew_email_subject + ) + self._account_validity_renew_by_email_enabled = ( + self.hs.config.account_validity_renew_by_email_enabled + ) if ( - self._account_validity.enabled - and self._account_validity.renew_by_email_enabled + self._account_validity_enabled + and self._account_validity_renew_by_email_enabled ): # Don't do email-specific configuration if renewal by email is disabled. self._template_html = self.config.account_validity_template_html @@ -53,14 +60,14 @@ class AccountValidityHandler: try: app_name = self.hs.config.email_app_name - self._subject = self._account_validity.renew_email_subject % { + self._subject = self._account_validity_renew_email_subject % { "app": app_name } self._from_string = self.hs.config.email_notif_from % {"app": app_name} except Exception: # If substitution failed, fall back to the bare strings. - self._subject = self._account_validity.renew_email_subject + self._subject = self._account_validity_renew_email_subject self._from_string = self.hs.config.email_notif_from self._raw_from = email.utils.parseaddr(self._from_string)[1] @@ -258,7 +265,7 @@ class AccountValidityHandler: milliseconds since epoch. """ if expiration_ts is None: - expiration_ts = self.clock.time_msec() + self._account_validity.period + expiration_ts = self.clock.time_msec() + self._account_validity_period await self.store.set_account_validity_for_user( user_id=user_id, expiration_ts=expiration_ts, email_sent=email_sent diff --git a/synapse/handlers/deactivate_account.py b/synapse/handlers/deactivate_account.py index e808142365..b2f965093f 100644 --- a/synapse/handlers/deactivate_account.py +++ b/synapse/handlers/deactivate_account.py @@ -49,7 +49,7 @@ class DeactivateAccountHandler(BaseHandler): if hs.config.run_background_tasks: hs.get_reactor().callWhenRunning(self._start_user_parting) - self._account_validity_enabled = hs.config.account_validity.enabled + self._account_validity_enabled = hs.config.account_validity_enabled async def deactivate_account( self, user_id: str, erase_data: bool, id_server: Optional[str] = None |