summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorry Haines2022-11-29 08:32:38 -0800
committerGitHub2022-11-29 09:32:38 -0700
commit17107618a00cadf93ac4803910509e793a80774d (patch)
tree037b86eb106569f4214b8d93845f45d805bfd25e
parentc72893372afe255689ff56a618b6c849974569a3 (diff)
downloadtakahe-17107618a00cadf93ac4803910509e793a80774d.tar.gz
takahe-17107618a00cadf93ac4803910509e793a80774d.tar.bz2
takahe-17107618a00cadf93ac4803910509e793a80774d.zip
unquote SMTP and AWS passwords (#78)
Passwords can contain characters that are illegal in URL identities. So use unquote to solve that. WARNING: This means that a freak URL escape in a password will fail in the opposite way. But since this is a URL, everything _must_ be urlencoded for sanity.
-rw-r--r--takahe/settings.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/takahe/settings.py b/takahe/settings.py
index ae07ecd..2dc4ffa 100644
--- a/takahe/settings.py
+++ b/takahe/settings.py
@@ -284,7 +284,7 @@ if SETUP.EMAIL_SERVER:
EMAIL_HOST = parsed.hostname
EMAIL_PORT = parsed.port
EMAIL_HOST_USER = parsed.username
- EMAIL_HOST_PASSWORD = parsed.password
+ EMAIL_HOST_PASSWORD = urllib.parse.unquote(parsed.password)
EMAIL_USE_TLS = as_bool(query.get("tls"))
EMAIL_USE_SSL = as_bool(query.get("ssl"))
else:
@@ -306,7 +306,7 @@ if SETUP.MEDIA_BACKEND:
AWS_STORAGE_BUCKET_NAME = parsed.path.lstrip("/")
if parsed.username is not None:
AWS_ACCESS_KEY_ID = parsed.username
- AWS_SECRET_ACCESS_KEY = parsed.password
+ AWS_SECRET_ACCESS_KEY = urllib.parse.unquote(parsed.password)
if parsed.hostname is not None:
port = parsed.port or 443
AWS_S3_ENDPOINT_URL = f"https://{parsed.hostname}:{port}"