mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-11 20:42:23 +01:00
Lint
This commit is contained in:
parent
3ff3dfe5a3
commit
f25f638c35
3 changed files with 10 additions and 17 deletions
|
@ -14,10 +14,10 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pkg_resources
|
|
||||||
|
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
|
|
||||||
|
import pkg_resources
|
||||||
|
|
||||||
from synapse.config._base import Config, ConfigError
|
from synapse.config._base import Config, ConfigError
|
||||||
from synapse.types import RoomAlias
|
from synapse.types import RoomAlias
|
||||||
from synapse.util.stringutils import random_string_with_symbols
|
from synapse.util.stringutils import random_string_with_symbols
|
||||||
|
@ -54,13 +54,10 @@ class AccountValidityConfig(Config):
|
||||||
template_dir = pkg_resources.resource_filename("synapse", "res/templates")
|
template_dir = pkg_resources.resource_filename("synapse", "res/templates")
|
||||||
|
|
||||||
if "account_renewed_html_path" in config:
|
if "account_renewed_html_path" in config:
|
||||||
file_path = os.path.join(
|
file_path = os.path.join(template_dir, config["account_renewed_html_path"])
|
||||||
template_dir, config["account_renewed_html_path"],
|
|
||||||
)
|
|
||||||
|
|
||||||
self.account_renewed_html_content = self.read_file(
|
self.account_renewed_html_content = self.read_file(
|
||||||
file_path,
|
file_path, "account_validity.account_renewed_html_path"
|
||||||
"account_validity.account_renewed_html_path",
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.account_renewed_html_content = (
|
self.account_renewed_html_content = (
|
||||||
|
@ -68,12 +65,10 @@ class AccountValidityConfig(Config):
|
||||||
)
|
)
|
||||||
|
|
||||||
if "invalid_token_html_path" in config:
|
if "invalid_token_html_path" in config:
|
||||||
file_path = os.path.join(
|
file_path = os.path.join(template_dir, config["invalid_token_html_path"])
|
||||||
template_dir, config["invalid_token_html_path"],
|
|
||||||
)
|
|
||||||
|
|
||||||
self.invalid_token_html_content = self.read_file(
|
self.invalid_token_html_content = self.read_file(
|
||||||
file_path, "account_validity.invalid_token_html_path",
|
file_path, "account_validity.invalid_token_html_path"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.invalid_token_html_content = (
|
self.invalid_token_html_content = (
|
||||||
|
|
|
@ -52,7 +52,7 @@ class AccountValidityRenewServlet(RestServlet):
|
||||||
renewal_token = request.args[b"token"][0]
|
renewal_token = request.args[b"token"][0]
|
||||||
|
|
||||||
token_valid = yield self.account_activity_handler.renew_account(
|
token_valid = yield self.account_activity_handler.renew_account(
|
||||||
renewal_token.decode("utf8"),
|
renewal_token.decode("utf8")
|
||||||
)
|
)
|
||||||
|
|
||||||
if token_valid:
|
if token_valid:
|
||||||
|
@ -64,9 +64,7 @@ class AccountValidityRenewServlet(RestServlet):
|
||||||
|
|
||||||
request.setResponseCode(status_code)
|
request.setResponseCode(status_code)
|
||||||
request.setHeader(b"Content-Type", b"text/html; charset=utf-8")
|
request.setHeader(b"Content-Type", b"text/html; charset=utf-8")
|
||||||
request.setHeader(
|
request.setHeader(b"Content-Length", b"%d" % (len(response),))
|
||||||
b"Content-Length", b"%d" % (len(response),)
|
|
||||||
)
|
|
||||||
request.write(response.encode("utf8"))
|
request.write(response.encode("utf8"))
|
||||||
finish_request(request)
|
finish_request(request)
|
||||||
defer.returnValue(None)
|
defer.returnValue(None)
|
||||||
|
|
Loading…
Reference in a new issue