diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2020-08-17 17:05:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 17:05:00 +0100 |
commit | e04e465b4d2c66acb8885c31736c7b7bb4e7be52 (patch) | |
tree | 19a4ec88b2767c3bb51ba79f0f9a07da1fd15786 /synapse/config/saml2_config.py | |
parent | Merge branch 'master' into develop (diff) | |
download | synapse-e04e465b4d2c66acb8885c31736c7b7bb4e7be52.tar.xz |
Use the default templates when a custom template file cannot be found (#8037)
Fixes https://github.com/matrix-org/synapse/issues/6583
Diffstat (limited to 'synapse/config/saml2_config.py')
-rw-r--r-- | synapse/config/saml2_config.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/synapse/config/saml2_config.py b/synapse/config/saml2_config.py index 9277b5f342..036f8c0e90 100644 --- a/synapse/config/saml2_config.py +++ b/synapse/config/saml2_config.py @@ -18,8 +18,6 @@ import logging from typing import Any, List import attr -import jinja2 -import pkg_resources from synapse.python_dependencies import DependencyException, check_requirements from synapse.util.module_loader import load_module, load_python_module @@ -171,15 +169,9 @@ class SAML2Config(Config): saml2_config.get("saml_session_lifetime", "15m") ) - template_dir = saml2_config.get("template_dir") - if not template_dir: - template_dir = pkg_resources.resource_filename("synapse", "res/templates",) - - loader = jinja2.FileSystemLoader(template_dir) - # enable auto-escape here, to having to remember to escape manually in the - # template - env = jinja2.Environment(loader=loader, autoescape=True) - self.saml2_error_html_template = env.get_template("saml_error.html") + self.saml2_error_html_template = self.read_templates( + ["saml_error.html"], saml2_config.get("template_dir") + ) def _default_saml_config_dict( self, required_attributes: set, optional_attributes: set |