diff --git a/allianceauth/authentication/templates/public/base.html b/allianceauth/authentication/templates/public/base.html
index 9276a5bb..62529bda 100644
--- a/allianceauth/authentication/templates/public/base.html
+++ b/allianceauth/authentication/templates/public/base.html
@@ -8,7 +8,7 @@
-
+
{% include 'allianceauth/icons.html' %}
diff --git a/allianceauth/context_processors.py b/allianceauth/context_processors.py
index 3fc65aa5..4feb243e 100644
--- a/allianceauth/context_processors.py
+++ b/allianceauth/context_processors.py
@@ -5,5 +5,6 @@ from .views import NightModeRedirectView
def auth_settings(request):
return {
'SITE_NAME': settings.SITE_NAME,
+ 'SITE_URL': settings.SITE_URL,
'NIGHT_MODE': NightModeRedirectView.night_mode_state(request),
}
diff --git a/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html b/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html
index 196ce6e0..12c89ed0 100644
--- a/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html
+++ b/allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html
@@ -60,7 +60,7 @@
-
+
diff --git a/allianceauth/srp/templates/srp/add.html b/allianceauth/srp/templates/srp/add.html
index 260a929a..5b38500d 100644
--- a/allianceauth/srp/templates/srp/add.html
+++ b/allianceauth/srp/templates/srp/add.html
@@ -25,7 +25,8 @@
{% else %}
{% blocktranslate %}Give this link to the line members{% endblocktranslate %}.
- {{ request.scheme }}://{{ request.get_host }}{% url 'srp:request' completed_srp_code %}
+ {{ SITE_URL }}{% url 'srp:request' completed_srp_code %}
+
diff --git a/tests/settings_all.py b/tests/settings_all.py
index e998f824..707eac69 100644
--- a/tests/settings_all.py
+++ b/tests/settings_all.py
@@ -10,40 +10,43 @@ from allianceauth.project_template.project_name.settings.base import *
CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing
INSTALLED_APPS += [
- 'allianceauth.eveonline.autogroups',
- 'allianceauth.hrapplications',
- 'allianceauth.timerboard',
- 'allianceauth.srp',
- 'allianceauth.optimer',
- 'allianceauth.corputils',
- 'allianceauth.fleetactivitytracking',
- 'allianceauth.permissions_tool',
- 'allianceauth.services.modules.mumble',
- 'allianceauth.services.modules.discord',
- 'allianceauth.services.modules.discourse',
- 'allianceauth.services.modules.ips4',
- 'allianceauth.services.modules.openfire',
- 'allianceauth.services.modules.smf',
- 'allianceauth.services.modules.phpbb3',
- 'allianceauth.services.modules.xenforo',
- 'allianceauth.services.modules.teamspeak3',
+ "allianceauth.eveonline.autogroups",
+ "allianceauth.hrapplications",
+ "allianceauth.timerboard",
+ "allianceauth.srp",
+ "allianceauth.optimer",
+ "allianceauth.corputils",
+ "allianceauth.fleetactivitytracking",
+ "allianceauth.permissions_tool",
+ "allianceauth.services.modules.mumble",
+ "allianceauth.services.modules.discord",
+ "allianceauth.services.modules.discourse",
+ "allianceauth.services.modules.ips4",
+ "allianceauth.services.modules.openfire",
+ "allianceauth.services.modules.smf",
+ "allianceauth.services.modules.phpbb3",
+ "allianceauth.services.modules.xenforo",
+ "allianceauth.services.modules.teamspeak3",
]
-ROOT_URLCONF = 'tests.urls'
+ROOT_URLCONF = "tests.urls"
+
+SITE_URL = "https://example.com"
+CSRF_TRUSTED_ORIGINS = [SITE_URL]
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
- "LOCATION": "redis://127.0.0.1:6379/1"
+ "LOCATION": "redis://127.0.0.1:6379/1",
}
}
########################
# XenForo Configuration
########################
-XENFORO_ENDPOINT = 'example.com/api.php'
+XENFORO_ENDPOINT = "example.com/api.php"
XENFORO_DEFAULT_GROUP = 0
-XENFORO_APIKEY = 'yourapikey'
+XENFORO_APIKEY = "yourapikey"
#####################
######################
@@ -79,7 +82,7 @@ MUMBLE_SERVER_ID = 1
######################################
# PHPBB3 Configuration
######################################
-PHPBB3_URL = ''
+PHPBB3_URL = ""
######################################
# Teamspeak3 Configuration
@@ -92,12 +95,12 @@ PHPBB3_URL = ''
# TEAMSPEAK3_AUTHED_GROUP_ID - Default authed group id
# TEAMSPEAK3_PUBLIC_URL - teamspeak3 public url used for link creation
######################################
-TEAMSPEAK3_SERVER_IP = '127.0.0.1'
+TEAMSPEAK3_SERVER_IP = "127.0.0.1"
TEAMSPEAK3_SERVER_PORT = 10011
-TEAMSPEAK3_SERVERQUERY_USER = 'serveradmin'
-TEAMSPEAK3_SERVERQUERY_PASSWORD = 'passwordhere'
+TEAMSPEAK3_SERVERQUERY_USER = "serveradmin"
+TEAMSPEAK3_SERVERQUERY_PASSWORD = "passwordhere"
TEAMSPEAK3_VIRTUAL_SERVER = 1
-TEAMSPEAK3_PUBLIC_URL = 'example.com'
+TEAMSPEAK3_PUBLIC_URL = "example.com"
######################################
# Discord Configuration
@@ -110,13 +113,13 @@ TEAMSPEAK3_PUBLIC_URL = 'example.com'
# DISCORD_CALLBACK_URL - oauth callback url
# DISCORD_SYNC_NAMES - enable to force discord nicknames to be set to eve char name (bot needs Manage Nicknames permission)
######################################
-DISCORD_GUILD_ID = '0118999'
-DISCORD_BOT_TOKEN = 'bottoken'
-DISCORD_INVITE_CODE = 'invitecode'
-DISCORD_APP_ID = 'appid'
-DISCORD_APP_SECRET = 'secret'
-DISCORD_CALLBACK_URL = 'http://example.com/discord/callback'
-DISCORD_SYNC_NAMES = 'True' == 'False'
+DISCORD_GUILD_ID = "0118999"
+DISCORD_BOT_TOKEN = "bottoken"
+DISCORD_INVITE_CODE = "invitecode"
+DISCORD_APP_ID = "appid"
+DISCORD_APP_SECRET = "secret"
+DISCORD_CALLBACK_URL = "http://example.com/discord/callback"
+DISCORD_SYNC_NAMES = "True" == "False"
######################################
# Discourse Configuration
@@ -126,10 +129,10 @@ DISCORD_SYNC_NAMES = 'True' == 'False'
# DISCOURSE_API_KEY - API Key
# DISCOURSE_SSO_SECRET - SSO secret key
######################################
-DISCOURSE_URL = 'https://example.com'
-DISCOURSE_API_USERNAME = ''
-DISCOURSE_API_KEY = ''
-DISCOURSE_SSO_SECRET = 'd836444a9e4084d5b224a60c208dce14'
+DISCOURSE_URL = "https://example.com"
+DISCOURSE_API_USERNAME = ""
+DISCOURSE_API_KEY = ""
+DISCOURSE_SSO_SECRET = "d836444a9e4084d5b224a60c208dce14"
# Example secret from https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
#####################################
@@ -138,16 +141,16 @@ DISCOURSE_SSO_SECRET = 'd836444a9e4084d5b224a60c208dce14'
# IPS4_URL - base url of the IPS4 install (no trailing slash)
# IPS4_API_KEY - API key provided by IPS4
#####################################
-IPS4_URL = 'http://example.com/ips4'
-IPS4_API_KEY = ''
+IPS4_URL = "http://example.com/ips4"
+IPS4_API_KEY = ""
######################################
# SMF Configuration
######################################
-SMF_URL = ''
+SMF_URL = ""
PASSWORD_HASHERS = [
- 'django.contrib.auth.hashers.MD5PasswordHasher',
+ "django.contrib.auth.hashers.MD5PasswordHasher",
]
LOGGING = None # Comment out to enable logging for debugging
diff --git a/tests/settings_core.py b/tests/settings_core.py
index f34e37af..fffb86a0 100644
--- a/tests/settings_core.py
+++ b/tests/settings_core.py
@@ -10,17 +10,20 @@ from allianceauth.project_template.project_name.settings.base import *
CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing
-ROOT_URLCONF = 'tests.urls'
+ROOT_URLCONF = "tests.urls"
+
+SITE_URL = "https://example.com"
+CSRF_TRUSTED_ORIGINS = [SITE_URL]
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
- "LOCATION": "redis://127.0.0.1:6379/1"
+ "LOCATION": "redis://127.0.0.1:6379/1",
}
}
PASSWORD_HASHERS = [
- 'django.contrib.auth.hashers.MD5PasswordHasher',
+ "django.contrib.auth.hashers.MD5PasswordHasher",
]
LOGGING = None # Comment out to enable logging for debugging