summary refs log tree commit diff
path: root/synapse/handlers/account_validity.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-07-31 18:12:04 +0200
committerBrendan Abolivier <babolivier@matrix.org>2019-08-01 16:08:38 +0200
commit235271be4f716919765a7b1545fd680a00b9bda8 (patch)
treefa1b0dfdf8f1ebb4c01b47fbc0d51de70660c9c9 /synapse/handlers/account_validity.py
parentCheck room ID and type of redacted event (#5784) (diff)
downloadsynapse-235271be4f716919765a7b1545fd680a00b9bda8.tar.xz
Allow defining HTML templates to serve the user on account renewal
Diffstat (limited to 'synapse/handlers/account_validity.py')
-rw-r--r--synapse/handlers/account_validity.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/handlers/account_validity.py b/synapse/handlers/account_validity.py
index 5e0b92eb1c..396f0059f7 100644
--- a/synapse/handlers/account_validity.py
+++ b/synapse/handlers/account_validity.py
@@ -223,11 +223,19 @@ class AccountValidityHandler(object):
 
         Args:
             renewal_token (str): Token sent with the renewal request.
+        Returns:
+            bool: Whether the provided token is valid.
         """
-        user_id = yield self.store.get_user_from_renewal_token(renewal_token)
+        try:
+            user_id = yield self.store.get_user_from_renewal_token(renewal_token)
+        except StoreError:
+            defer.returnValue(False)
+
         logger.debug("Renewing an account for user %s", user_id)
         yield self.renew_account_for_user(user_id)
 
+        defer.returnValue(True)
+
     @defer.inlineCallbacks
     def renew_account_for_user(self, user_id, expiration_ts=None, email_sent=False):
         """Renews the account attached to a given user by pushing back the