mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
[Breaking] Webhooks: disallow deprecated WEBHOOK_AUTHORIZATION setting
Drop support for the WEBHOOK_AUTHORIZATION setting deprecated in v1.4. Only the WEBHOOK_SECRET replacement is allowed now. Most Django management commands will now issue a system check error if the old name is still used in settings.py
This commit is contained in:
@@ -7,18 +7,20 @@ def check_deprecated_settings(app_configs, **kwargs):
|
||||
|
||||
anymail_settings = getattr(settings, "ANYMAIL", {})
|
||||
|
||||
# anymail.W001: rename WEBHOOK_AUTHORIZATION to WEBHOOK_SECRET
|
||||
# anymail.W001: reserved [was deprecation warning that became anymail.E001]
|
||||
|
||||
# anymail.E001: rename WEBHOOK_AUTHORIZATION to WEBHOOK_SECRET
|
||||
if "WEBHOOK_AUTHORIZATION" in anymail_settings:
|
||||
errors.append(checks.Warning(
|
||||
errors.append(checks.Error(
|
||||
"The ANYMAIL setting 'WEBHOOK_AUTHORIZATION' has been renamed 'WEBHOOK_SECRET' to improve security.",
|
||||
hint="You must update your settings.py. The old name will stop working in a near-future release.",
|
||||
id="anymail.W001",
|
||||
hint="You must update your settings.py.",
|
||||
id="anymail.E001",
|
||||
))
|
||||
if hasattr(settings, "ANYMAIL_WEBHOOK_AUTHORIZATION"):
|
||||
errors.append(checks.Warning(
|
||||
errors.append(checks.Error(
|
||||
"The ANYMAIL_WEBHOOK_AUTHORIZATION setting has been renamed ANYMAIL_WEBHOOK_SECRET to improve security.",
|
||||
hint="You must update your settings.py. The old name will stop working in a near-future release.",
|
||||
id="anymail.W001",
|
||||
hint="You must update your settings.py.",
|
||||
id="anymail.E001",
|
||||
))
|
||||
|
||||
return errors
|
||||
|
||||
Reference in New Issue
Block a user