summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2022-03-11 16:15:11 +0100
committerGitHub <noreply@github.com>2022-03-11 15:15:11 +0000
commite6a106fd5ebbf30a7c84f8ba09dc903d20213be3 (patch)
treeef6a140878f1fa7903842f943da01fa2e40fc0a8 /synapse/handlers
parentImprove code documentation for the typing stream over replication. (#12211) (diff)
downloadsynapse-e6a106fd5ebbf30a7c84f8ba09dc903d20213be3.tar.xz
Implement a Jinja2 filter to extract localparts from email addresses (#12212)
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/oidc.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/handlers/oidc.py b/synapse/handlers/oidc.py
index d98659edc7..724b9cfcb4 100644
--- a/synapse/handlers/oidc.py
+++ b/synapse/handlers/oidc.py
@@ -45,6 +45,7 @@ from synapse.types import JsonDict, UserID, map_username_to_mxid_localpart
 from synapse.util import Clock, json_decoder
 from synapse.util.caches.cached_call import RetryOnExceptionCachedCall
 from synapse.util.macaroons import get_value_from_macaroon, satisfy_expiry
+from synapse.util.templates import _localpart_from_email_filter
 
 if TYPE_CHECKING:
     from synapse.server import HomeServer
@@ -1308,6 +1309,11 @@ def jinja_finalize(thing: Any) -> Any:
 
 
 env = Environment(finalize=jinja_finalize)
+env.filters.update(
+    {
+        "localpart_from_email": _localpart_from_email_filter,
+    }
+)
 
 
 @attr.s(slots=True, frozen=True, auto_attribs=True)