Compare commits

..

5 Commits

Author SHA1 Message Date
Ariel Rin
3935a9cdd2 Version Bump 4.0.0b2 2024-02-24 14:44:49 +10:00
Ariel Rin
49fb6c39d5 Merge branch 'navactive' into 'v4.x'
Errors thrown here cause 404 error handling to fail. 404s cant url resolve.

See merge request allianceauth/allianceauth!1598
2024-02-24 04:42:48 +00:00
Ariel Rin
8821f18b21 Errors thrown here cause 404 error handling to fail. 404s cant url resolve. 2024-02-24 04:42:48 +00:00
Ariel Rin
1c7f8256d0 Merge branch 'fix-filenames' into 'v4.x'
[AA4] Fix dots in file names

See merge request allianceauth/allianceauth!1597
2024-02-22 03:00:47 +00:00
Erik Kalkoken
61f0aae5d9 [AA4] Fix dots in file names 2024-02-22 03:00:47 +00:00
7 changed files with 38 additions and 32 deletions

View File

@@ -5,7 +5,7 @@ manage online service access.
# This will make sure the app is always imported when # This will make sure the app is always imported when
# Django starts so that shared_task will use this app. # Django starts so that shared_task will use this app.
__version__ = '4.0.0b1' __version__ = '4.0.0b2'
__title__ = 'Alliance Auth' __title__ = 'Alliance Auth'
__url__ = 'https://gitlab.com/allianceauth/allianceauth' __url__ = 'https://gitlab.com/allianceauth/allianceauth'
NAME = f'{__title__} v{__version__}' NAME = f'{__title__} v{__version__}'

View File

@@ -1,8 +1,6 @@
import logging import logging
import requests import requests
from allianceauth.hooks import get_hooks
from django_registration.backends.activation.views import ( from django_registration.backends.activation.views import (
REGISTRATION_SALT, ActivationView as BaseActivationView, REGISTRATION_SALT, ActivationView as BaseActivationView,
RegistrationView as BaseRegistrationView, RegistrationView as BaseRegistrationView,
@@ -34,7 +32,7 @@ from .models import CharacterOwnership
if 'allianceauth.eveonline.autogroups' in settings.INSTALLED_APPS: if 'allianceauth.eveonline.autogroups' in settings.INSTALLED_APPS:
_has_auto_groups = True _has_auto_groups = True
from allianceauth.eveonline.autogroups.models import * from allianceauth.eveonline.autogroups.models import * # noqa: F401, F403
else: else:
_has_auto_groups = False _has_auto_groups = False
@@ -58,7 +56,7 @@ def dashboard_groups(request):
context = { context = {
'groups': groups, 'groups': groups,
} }
return render_to_string('authentication/dashboard.groups.html', context=context, request=request) return render_to_string('authentication/dashboard_groups.html', context=context, request=request)
def dashboard_characters(request): def dashboard_characters(request):
@@ -70,7 +68,7 @@ def dashboard_characters(request):
context = { context = {
'characters': characters 'characters': characters
} }
return render_to_string('authentication/dashboard.characters.html', context=context, request=request) return render_to_string('authentication/dashboard_characters.html', context=context, request=request)
def dashboard_admin(request): def dashboard_admin(request):
@@ -164,10 +162,12 @@ def main_character_change(request, token):
if co: if co:
request.user.profile.main_character = co.character request.user.profile.main_character = co.character
request.user.profile.save(update_fields=['main_character']) request.user.profile.save(update_fields=['main_character'])
messages.success(request, _('Changed main character to %(char)s') % { messages.success(request, _('Changed main character to %s') % co.character)
"char": co.character}) logger.info(
logger.info('Changed user %(user)s main character to %(char)s' % 'Changed user {user} main character to {char}'.format(
({'user': request.user, 'char': co.character})) user=request.user, char=co.character
)
)
return redirect("authentication:dashboard") return redirect("authentication:dashboard")
@@ -222,8 +222,10 @@ def sso_login(request, token):
token.delete() token.delete()
messages.error( messages.error(
request, request,
_('Unable to authenticate as the selected character. ' _(
'Please log in with the main character associated with this account.') 'Unable to authenticate as the selected character. '
'Please log in with the main character associated with this account.'
)
) )
return redirect(settings.LOGIN_URL) return redirect(settings.LOGIN_URL)
@@ -306,8 +308,7 @@ class RegistrationView(BaseRegistrationView):
else: else:
user.is_active = True user.is_active = True
user.save() user.save()
login(self.request, user, login(self.request, user, 'allianceauth.authentication.backends.StateBackend')
'allianceauth.authentication.backends.StateBackend')
return user return user
def get_activation_key(self, user): def get_activation_key(self, user):

View File

@@ -23,6 +23,7 @@ THE SOFTWARE.
""" """
from django.template import Library from django.template import Library
from django.urls import resolve from django.urls import resolve
from django.urls.exceptions import Resolver404
from django.conf import settings from django.conf import settings
import re import re
@@ -45,19 +46,23 @@ def navactive(request, urls):
{% navactive request "view_name another_view_name" %} {% navactive request "view_name another_view_name" %}
""" """
url_list = set(urls.split()) url_list = set(urls.split())
try:
resolved = resolve(request.path) resolved = resolve(request.path)
resolved_urls = set() resolved_urls = set()
if resolved.url_name: if resolved.url_name:
resolved_urls.add(resolved.url_name) resolved_urls.add(resolved.url_name)
if resolved.namespaces: if resolved.namespaces:
resolved_urls = resolved_urls.union([f"{namespace}:{resolved.url_name}" for namespace in resolved.namespaces]) resolved_urls = resolved_urls.union(
resolved_urls = resolved_urls.union([f"{namespace}:" for namespace in resolved.namespaces]) [f"{namespace}:{resolved.url_name}" for namespace in resolved.namespaces])
if getattr(resolved, 'app_name', None): resolved_urls = resolved_urls.union([f"{namespace}:" for namespace in resolved.namespaces])
resolved_urls = resolved_urls.union([f"{resolved.app_name}:{resolved.url_name}", f"{resolved.app_name}:"]) if getattr(resolved, 'app_name', None):
if getattr(resolved, 'app_names', []): resolved_urls = resolved_urls.union([f"{resolved.app_name}:{resolved.url_name}", f"{resolved.app_name}:"])
resolved_urls = resolved_urls.union([f"{app_name}:{resolved.url_name}" for app_name in resolved.app_names]) if getattr(resolved, 'app_names', []):
resolved_urls = resolved_urls.union([f"{app_name}:" for app_name in resolved.app_names]) resolved_urls = resolved_urls.union([f"{app_name}:{resolved.url_name}" for app_name in resolved.app_names])
if url_list and resolved_urls and bool(resolved_urls & url_list): resolved_urls = resolved_urls.union([f"{app_name}:" for app_name in resolved.app_names])
return getattr(settings, "NAVHELPER_ACTIVE_CLASS", "active") if url_list and resolved_urls and bool(resolved_urls & url_list):
return getattr(settings, "NAVHELPER_ACTIVE_CLASS", "active")
except Resolver404:
pass
# 404 errors can't url resolve
return getattr(settings, "NAVHELPER_NOT_ACTIVE_CLASS", "") return getattr(settings, "NAVHELPER_NOT_ACTIVE_CLASS", "")

View File

@@ -1,7 +1,7 @@
PROTOCOL=https:// PROTOCOL=https://
AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN% AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN%
DOMAIN=%DOMAIN% DOMAIN=%DOMAIN%
AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v4.0.0b1 AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v4.0.0b2
# Nginx Proxy Manager # Nginx Proxy Manager
PROXY_HTTP_PORT=80 PROXY_HTTP_PORT=80

View File

@@ -1,5 +1,5 @@
FROM python:3.11-slim FROM python:3.11-slim
ARG AUTH_VERSION=v4.0.0b1 ARG AUTH_VERSION=v4.0.0b2
ARG AUTH_PACKAGE=allianceauth==${AUTH_VERSION} ARG AUTH_PACKAGE=allianceauth==${AUTH_VERSION}
ENV AUTH_USER=allianceauth ENV AUTH_USER=allianceauth
ENV AUTH_GROUP=allianceauth ENV AUTH_GROUP=allianceauth