Compare commits

...

37 Commits

Author SHA1 Message Date
Ariel Rin
a47bd8d7c7 Version Bump 3.0.0b3 2022-07-11 14:20:53 +10:00
Ariel Rin
54bce4315b Merge branch 'add-filterdropdown-js-to-bundles' into 'v3.x'
Add filterdropdown js to bundles

See merge request allianceauth/allianceauth!1436
2022-07-11 04:14:46 +00:00
Peter Pfeufer
8c1f06d7b8 Added refresh_notifications.js to bundles
Probably used in template overrides
2022-07-09 15:51:55 +02:00
Peter Pfeufer
815b6fa030 Added eve-time.js to bundles
Probably used in template overrides
2022-07-09 15:50:09 +02:00
Peter Pfeufer
7c05217900 Add timers.js to bundle
It's used in `mumbletemps`
2022-07-09 15:45:25 +02:00
Peter Pfeufer
d8c2944966 [FIX] table HTML syntax 2022-07-07 11:55:10 +02:00
Peter Pfeufer
7669c9e55d Add filterDropDown.js to bundles 2022-07-07 11:54:31 +02:00
Ariel Rin
71c9faaf28 Version Bump 3.0.0b2 2022-07-07 18:15:37 +10:00
Ariel Rin
236c70316c Merge branch 'master' of https://gitlab.com/allianceauth/allianceauth into v3.x 2022-07-07 18:07:49 +10:00
Ariel Rin
0d0686f58a Merge branch 'allianceauth-prefix-static-files-directory' into v3.x 2022-07-07 18:01:12 +10:00
Ariel Rin
3706a1aedf Merge branch 'improve-autodocs-for-models' into 'master'
Improve autodocs for models & more

See merge request allianceauth/allianceauth!1435
2022-07-07 07:38:58 +00:00
Ariel Rin
47f1b77320 Merge branch 'consolidate-redis-client-access' into 'master'
Ensure backwards compatibility when fetching a redis client

See merge request allianceauth/allianceauth!1428
2022-07-07 07:37:21 +00:00
Erik Kalkoken
8dec242a93 Ensure backwards compatibility when fetching a redis client 2022-07-07 07:37:21 +00:00
Ariel Rin
6b934060dd Merge branch 'remove-old-unused-templates' into 'v3.x'
Remove unused templates

See merge request allianceauth/allianceauth!1431
2022-07-07 07:36:21 +00:00
Ariel Rin
ff88a16163 Merge branch 'smf-2.1-compatibility' into 'v3.x'
SMF 2.1 compatibility

See merge request allianceauth/allianceauth!1432
2022-07-07 07:35:58 +00:00
Ariel Rin
e81a66b74b Merge branch 'setup.cfg-vs-manifest-part-2' into 'v3.x'
setup.cfg vs MANIFEST.in (Round 2)

See merge request allianceauth/allianceauth!1434
2022-07-07 07:34:17 +00:00
ErikKalkoken
2ff200c566 Refer to django-esi docs 2022-06-27 13:43:45 +02:00
ErikKalkoken
091a2637ea Add extension to improve autodocs for Django models & enable source links 2022-06-27 13:41:15 +02:00
Peter Pfeufer
6c7729308c Should be find_namespace 2022-06-27 05:39:45 +02:00
Peter Pfeufer
0195ef23d5 Attempt to remove MANIFEST.in file (Part 2) 2022-06-27 05:38:31 +02:00
Peter Pfeufer
a7afa4a0c3 Background for login page fixed 2022-06-25 14:44:28 +02:00
Peter Pfeufer
004100091f Moved authentication and services into allianceauth folder 2022-06-25 14:01:32 +02:00
Peter Pfeufer
20231ce198 Load static files from their new place 2022-06-25 13:51:46 +02:00
Peter Pfeufer
0851a6d085 [Cleanup] Removed {% load static %} when no static files are loaded 2022-06-25 13:51:10 +02:00
Peter Pfeufer
0cd36ad5bc Moved SSO button from "root" to "authentication" 2022-06-25 13:46:56 +02:00
Peter Pfeufer
7618dd0f91 Removed obsolete attribute 2022-06-25 13:31:12 +02:00
Peter Pfeufer
cf49a2cb65 Moved static files to their own directory 2022-06-25 13:30:32 +02:00
Peter Pfeufer
cbdce18633 Use regex to determine the SMF version (thanks @colcrunch) 2022-06-24 23:01:16 +02:00
Peter Pfeufer
a0d14eb1d3 SQL queries need to be different depending on SMF version
It's not a work of art, but it does the job. If anyone has a better idea, hit the comments ...
2022-06-24 22:40:04 +02:00
Peter Pfeufer
53ce4d2453 f-strings in log messages
Easier to read and modernized the code
2022-06-24 21:09:32 +02:00
Peter Pfeufer
1ddb041d6d Add Exception messages to exception logging 2022-06-24 21:00:54 +02:00
Peter Pfeufer
43cbfd1c47 Stop usage of deprecated logger functions 2022-06-24 20:57:58 +02:00
Peter Pfeufer
b9a8495a43 Add exception message to log output 2022-06-24 20:56:38 +02:00
Peter Pfeufer
e296477880 Use pwhash instead of passwd
This way we ensure that the initial password actually works and the user doesn't have to set a new one right away.
2022-06-24 20:55:04 +02:00
Peter Pfeufer
bd5c2d8cbc Removed non existent table columns from SQL query 2022-06-24 20:54:05 +02:00
Peter Pfeufer
ccd40d5c68 Remove unused templates 2022-06-23 21:26:13 +02:00
Ariel Rin
113977b19f Version Bump 2.13.0 2022-06-18 13:07:36 +10:00
113 changed files with 255 additions and 220 deletions

View File

@@ -25,7 +25,7 @@ repos:
rev: 2.4.0
hooks:
- id: editorconfig-checker
exclude: ^(LICENSE|allianceauth\/static\/css\/themes\/bootstrap-locals.less|allianceauth\/eveonline\/swagger.json|(.*.po)|(.*.mo))
exclude: ^(LICENSE|allianceauth\/static\/allianceauth\/css\/themes\/bootstrap-locals.less|allianceauth\/eveonline\/swagger.json|(.*.po)|(.*.mo))
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0

View File

@@ -1,7 +0,0 @@
include LICENSE
include README.md
include MANIFEST.in
graft allianceauth
global-exclude __pycache__
global-exclude *.py[co]

View File

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

View File

@@ -322,7 +322,7 @@ class UserAdmin(BaseUserAdmin):
class Media:
css = {
"all": ("authentication/css/admin.css",)
"all": ("allianceauth/authentication/css/admin.css",)
}
def get_queryset(self, request):
@@ -542,7 +542,7 @@ class BaseOwnershipAdmin(admin.ModelAdmin):
class Media:
css = {
"all": ("authentication/css/admin.css",)
"all": ("allianceauth/authentication/css/admin.css",)
}
def get_readonly_fields(self, request, obj=None):

View File

@@ -5,7 +5,7 @@ from typing import List, Optional
from pytz import utc
from redis import Redis, RedisError
from django_redis import get_redis_connection
from allianceauth.utils.cache import get_redis_client
logger = logging.getLogger(__name__)
@@ -39,7 +39,7 @@ class EventSeries:
_ROOT_KEY = "ALLIANCEAUTH_EVENT_SERIES"
def __init__(self, key_id: str, redis: Redis = None) -> None:
self._redis = get_redis_connection("default") if not redis else redis
self._redis = get_redis_client() if not redis else redis
try:
if not self._redis.ping():
raise RuntimeError()

View File

@@ -18,7 +18,7 @@ MODULE_PATH = "allianceauth.authentication.task_statistics.event_series"
class TestEventSeries(TestCase):
def test_should_abort_without_redis_client(self):
# when
with patch(MODULE_PATH + ".get_redis_connection") as mock:
with patch(MODULE_PATH + ".get_redis_client") as mock:
mock.return_value = None
events = EventSeries("dummy")
# then
@@ -27,8 +27,8 @@ class TestEventSeries(TestCase):
def test_should_disable_itself_if_redis_not_available_1(self):
# when
with patch(MODULE_PATH + ".get_redis_connection") as mock_get_redis_connection:
mock_get_redis_connection.return_value.ping.side_effect = RedisError
with patch(MODULE_PATH + ".get_redis_client") as mock_get_master_client:
mock_get_master_client.return_value.ping.side_effect = RedisError
events = EventSeries("dummy")
# then
self.assertIsInstance(events._redis, _RedisStub)
@@ -36,8 +36,8 @@ class TestEventSeries(TestCase):
def test_should_disable_itself_if_redis_not_available_2(self):
# when
with patch(MODULE_PATH + ".get_redis_connection") as mock_get_redis_connection:
mock_get_redis_connection.return_value.ping.return_value = False
with patch(MODULE_PATH + ".get_redis_client") as mock_get_master_client:
mock_get_master_client.return_value.ping.return_value = False
events = EventSeries("dummy")
# then
self.assertIsInstance(events._redis, _RedisStub)

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Dashboard" %}{% endblock %}
@@ -28,7 +27,7 @@
<table class="table">
<tr>
<td class="text-center">
<img class="ra-avatar"src="{{ main.portrait_url_128 }}">
<img class="ra-avatar" src="{{ main.portrait_url_128 }}">
</td>
</tr>
<tr>
@@ -40,7 +39,7 @@
<table class="table">
<tr>
<td class="text-center">
<img class="ra-avatar"src="{{ main.corporation_logo_url_128 }}">
<img class="ra-avatar" src="{{ main.corporation_logo_url_128 }}">
</td>
</tr>
<tr>
@@ -53,7 +52,7 @@
<table class="table">
<tr>
<td class="text-center">
<img class="ra-avatar"src="{{ main.alliance_logo_url_128 }}">
<img class="ra-avatar" src="{{ main.alliance_logo_url_128 }}">
</td>
</tr>
<tr>
@@ -64,7 +63,7 @@
<table class="table">
<tr>
<td class="text-center">
<img class="ra-avatar"src="{{ main.faction_logo_url_128 }}">
<img class="ra-avatar" src="{{ main.faction_logo_url_128 }}">
</td>
</tr>
<tr>

View File

@@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">
<meta property="og:title" content="{{ SITE_NAME }}">
<meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}{% static 'icons/apple-touch-icon.png' %}">
<meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}{% static 'allianceauth/icons/apple-touch-icon.png' %}">
<meta property="og:description" content="Alliance Auth - An auth system for EVE Online to help in-game organizations manage online service access.">
{% include 'allianceauth/icons.html' %}
@@ -21,7 +21,7 @@
<style>
body {
background: url('{% static 'authentication/img/background.jpg' %}') no-repeat center center fixed;
background: url('{% static 'allianceauth/authentication/img/background.jpg' %}') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;

View File

@@ -7,6 +7,6 @@
{% block middle_box_content %}
<a href="{% url 'auth_sso_login' %}{% if request.GET.next %}?next={{request.GET.next}}{%endif%}">
<img class="img-responsive center-block" src="{% static 'img/sso/EVE_SSO_Login_Buttons_Large_Black.png' %}" border=0>
<img class="img-responsive center-block" src="{% static 'allianceauth/authentication/img/sso/EVE_SSO_Login_Buttons_Large_Black.png' %}">
</a>
{% endblock %}

View File

@@ -1,5 +1,4 @@
{% extends 'public/base.html' %}
{% load static %}
{% block content %}
<div class="col-md-4 col-md-offset-4">
{% if messages %}

View File

@@ -1,6 +1,5 @@
{% extends 'public/base.html' %}
{% load static %}
{% load bootstrap %}
{% load i18n %}

View File

@@ -1,15 +0,0 @@
{% load i18n %}{% autoescape off %}
{% blocktrans trimmed %}You're receiving this email because you requested a password reset for your
user account.{% endblocktrans %}
{% translate "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{domain}}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% translate "Your username, in case you've forgotten:" %} {{ user.get_username }}
{% translate "Thanks for using our site!" %}
{% blocktrans %}Your IT Team{% endblocktrans %}
{% endautoescape %}

View File

@@ -1,14 +0,0 @@
{% extends 'public/middle_box.html' %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block page_title %}{% translate "Register" %}{% endblock %}
{% block middle_box_content %}
<form class="form-signin" role="form" action="" method="POST">
{% csrf_token %}
{{ form|bootstrap }}
<br>
<button class="btn btn-lg btn-primary btn-block" type="submit">{% translate "Submit" %}</button>
<br>
</form>
{% endblock %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Create Fatlink" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Fatlink view" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Personal fatlink statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Personal fatlink statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Fatlink Corp Statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Fatlink statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Fatlink view" %}{% endblock page_title %}

View File

@@ -25,13 +25,15 @@
<div class="table-responsive">
<table class="table table-striped" id="log-entries">
<thead>
<th scope="col">{% translate "Date/Time" %}</th>
<th scope="col">{% translate "Requestor" %}</th>
<th scope="col">{% translate "Character" %}</th>
<th scope="col">{% translate "Corporation" %}</th>
<th scope="col">{% translate "Type" %}</th>
<th scope="col">{% translate "Action" %}</th>
<th scope="col">{% translate "Actor" %}</th>
<tr>
<th scope="col">{% translate "Date/Time" %}</th>
<th scope="col">{% translate "Requestor" %}</th>
<th scope="col">{% translate "Character" %}</th>
<th scope="col">{% translate "Corporation" %}</th>
<th scope="col">{% translate "Type" %}</th>
<th scope="col">{% translate "Action" %}</th>
<th scope="col">{% translate "Actor" %}</th>
</tr>
</thead>
<tbody>
@@ -74,7 +76,7 @@
{% block extra_javascript %}
{% include 'bundles/datatables-js.html' %}
{% include 'bundles/moment-js.html' with locale=True %}
<script type="application/javascript" src="{% static 'js/filterDropDown/filterDropDown.min.js' %}"></script>
{% include 'bundles/filterdropdown-js.html' %}
{% endblock %}
{% block extra_css %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% load evelinks %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Groups Membership" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Available Groups" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% load evelinks %}

View File

@@ -1,4 +1,3 @@
{% load static %}
{% load i18n %}
{% load navactive %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Choose a Corp" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Apply To" %} {{ corp.corporation_name }}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "HR Application Management" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "HR Application Management" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load bootstrap %}
{% load i18n %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Notifications" %}{% endblock %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "View Notification" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}

View File

@@ -40,7 +40,7 @@
</div>
{% include 'bundles/moment-js.html' with locale=True %}
<script src="{% static 'js/timers.js' %}"></script>
{% include 'bundles/timers-js.html' %}
<script type="application/javascript">
// Data

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}

View File

@@ -47,7 +47,7 @@
{% block extra_javascript %}
{% include 'bundles/datatables-js.html' %}
<script type="application/javascript" src="{% static 'js/filterDropDown/filterDropDown.min.js' %}"></script>
{% include 'bundles/filterdropdown-js.html' %}
{% endblock %}
{% block extra_css %}

View File

@@ -80,7 +80,7 @@
{% block extra_javascript %}
{% include 'bundles/datatables-js.html' %}
<script type="application/javascript" src="{% static 'js/filterDropDown/filterDropDown.min.js' %}"></script>
{% include 'bundles/filterdropdown-js.html' %}
{% endblock %}
{% block extra_css %}

View File

@@ -17,7 +17,7 @@ class ServicesUserAdmin(admin.ModelAdmin):
"""Parent class for UserAdmin classes for all services"""
class Media:
css = {
"all": ("services/admin.css",)
"all": ("allianceauth/services/admin.css",)
}
search_fields = ('user__username',)

View File

@@ -8,7 +8,7 @@ from uuid import uuid1
from redis import Redis
import requests
from django_redis import get_redis_connection
from allianceauth.utils.cache import get_redis_client
from allianceauth import __title__ as AUTH_TITLE, __url__, __version__
@@ -103,7 +103,7 @@ class DiscordClient:
self._access_token = str(access_token)
self._is_rate_limited = bool(is_rate_limited)
if not redis:
self._redis = get_redis_connection("default")
self._redis = get_redis_client()
if not isinstance(self._redis, Redis):
raise RuntimeError(
'This class requires a Redis client, but none was provided '

View File

@@ -85,25 +85,18 @@ class TestBasicsAndHelpers(TestCase):
client = DiscordClient(TEST_BOT_TOKEN, mock_redis, is_rate_limited=True)
self.assertTrue(client.is_rate_limited)
@patch(MODULE_PATH + '.get_redis_connection')
def test_use_default_redis_if_none_provided(self, mock_caches):
my_redis = MagicMock(spec=Redis)
mock_caches.return_value = my_redis
def test_use_default_redis_if_none_provided(self):
client = DiscordClient(TEST_BOT_TOKEN)
self.assertTrue(mock_caches.called)
self.assertEqual(client._redis, my_redis)
@patch(MODULE_PATH + '.get_redis_connection')
def test_raise_exception_if_default_cache_is_not_redis(self, mock_caches):
my_redis = MagicMock()
mock_caches.return_value = my_redis
self.assertIsInstance(client._redis, Redis)
@patch(MODULE_PATH + '.get_redis_client')
def test_raise_exception_if_redis_client_not_found(self, mock_get_redis_client):
# given
mock_get_redis_client.return_value = None
# when
with self.assertRaises(RuntimeError):
DiscordClient(TEST_BOT_TOKEN)
self.assertTrue(mock_caches.called)
@requests_mock.Mocker()
class TestOtherMethods(TestCase):

View File

@@ -35,17 +35,17 @@ import logging
from uuid import uuid1
import random
from django.core.cache import caches
from django.contrib.auth.models import User, Group
from allianceauth.services.modules.discord.models import DiscordUser
from allianceauth.utils.cache import get_redis_client
logger = logging.getLogger('allianceauth')
MAX_RUNS = 3
def clear_cache():
default_cache = caches['default']
redis = default_cache.get_master_client()
redis = get_redis_client()
redis.flushall()
logger.info('Cache flushed')

View File

@@ -14,7 +14,6 @@ from requests.exceptions import HTTPError
import requests_mock
from django.contrib.auth.models import Group, User
from django_redis import get_redis_connection
from django.shortcuts import reverse
from django.test import TransactionTestCase, TestCase
from django.test.utils import override_settings
@@ -23,6 +22,7 @@ from allianceauth.authentication.models import State
from allianceauth.eveonline.models import EveCharacter
from allianceauth.notifications.models import Notification
from allianceauth.tests.auth_utils import AuthUtils
from allianceauth.utils.cache import get_redis_client
from . import (
TEST_GUILD_ID,
@@ -87,7 +87,7 @@ remove_guild_member_request = DiscordRequest(
def clear_cache():
redis = get_redis_connection('default')
redis = get_redis_client()
redis.flushall()
logger.info('Cache flushed')
@@ -108,7 +108,6 @@ def reset_testdata():
class TestServiceFeatures(TransactionTestCase):
fixtures = ['disable_analytics.json']
@classmethod
def setUpClass(cls):
super().setUpClass()

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Jabber Broadcast" %}{% endblock page_title %}

View File

@@ -6,6 +6,8 @@ import hashlib
import logging
import re
from packaging import version
from django.db import connections
from django.conf import settings
from allianceauth.eveonline.models import EveCharacter
@@ -20,9 +22,18 @@ class SmfManager:
def __init__(self):
pass
SQL_ADD_USER = r"INSERT INTO %smembers (member_name, passwd, email_address, date_registered, real_name," \
r" buddy_list, message_labels, openid_uri, signature, ignore_boards) " \
r"VALUES (%%s, %%s, %%s, %%s, %%s, 0, 0, 0, 0, 0)" % TABLE_PREFIX
# For SMF < 2.1
SQL_ADD_USER_SMF_20 = r"INSERT INTO %smembers (member_name, passwd, email_address, date_registered, real_name," \
r" buddy_list, message_labels, openid_uri, signature, ignore_boards) " \
r"VALUES (%%s, %%s, %%s, %%s, %%s, 0, 0, 0, 0, 0)" % TABLE_PREFIX
# For SMF >= 2.1
SQL_ADD_USER_SMF_21 = r"INSERT INTO %smembers (member_name, passwd, email_address, date_registered, real_name," \
r" buddy_list, signature, ignore_boards) " \
r"VALUES (%%s, %%s, %%s, %%s, %%s, 0, 0, 0)" % TABLE_PREFIX
# returns something like »window.smfVersion = "SMF 2.0.19";«
SQL_GET_CURRENT_SMF_VERSION = r"SELECT data FROM %sadmin_info_files WHERE filename = %%s" % TABLE_PREFIX
SQL_DEL_USER = r"DELETE FROM %smembers where member_name = %%s" % TABLE_PREFIX
@@ -46,6 +57,26 @@ class SmfManager:
SQL_ADD_USER_AVATAR = r"UPDATE %smembers SET avatar = %%s WHERE id_member = %%s" % TABLE_PREFIX
@classmethod
def _get_current_smf_version(cls) -> str:
"""
Get the current SMF version from the DB
:return:
"""
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_GET_CURRENT_SMF_VERSION, ['current-version.js'])
row = cursor.fetchone()
db_result = row[0]
pattern = re.compile(r"\d+(\.\d+)+")
result = pattern.search(db_result)
smf_version = result.group(0)
return smf_version
@staticmethod
def _sanitize_groupname(name):
name = name.strip(' _')
@@ -73,15 +104,15 @@ class SmfManager:
@classmethod
def create_group(cls, groupname):
logger.debug("Creating smf group %s" % groupname)
logger.debug(f"Creating smf group {groupname}")
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_ADD_GROUP, [groupname, groupname])
logger.info("Created smf group %s" % groupname)
logger.info(f"Created smf group {groupname}")
return cls.get_group_id(groupname)
@classmethod
def get_group_id(cls, groupname):
logger.debug("Getting smf group id for groupname %s" % groupname)
logger.debug(f"Getting smf group id for groupname {groupname}")
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_GET_GROUP_ID, [groupname])
row = cursor.fetchone()
@@ -90,14 +121,14 @@ class SmfManager:
@classmethod
def check_user(cls, username):
logger.debug("Checking smf username %s" % username)
logger.debug(f"Checking smf username {username}")
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_USER_ID_FROM_USERNAME, [cls.santatize_username(username)])
row = cursor.fetchone()
if row:
logger.debug("Found user %s on smf" % username)
logger.debug(f"Found user {username} on smf")
return True
logger.debug("User %s not found on smf" % username)
logger.debug(f"User {username} not found on smf")
return False
@classmethod
@@ -110,7 +141,7 @@ class SmfManager:
@classmethod
def get_user_id(cls, username):
logger.debug("Getting smf user id for username %s" % username)
logger.debug(f"Getting smf user id for username {username}")
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_USER_ID_FROM_USERNAME, [username])
row = cursor.fetchone()
@@ -118,7 +149,7 @@ class SmfManager:
logger.debug(f"Got smf user id {row[0]} for username {username}")
return row[0]
else:
logger.error("username %s not found on smf. Unable to determine user id ." % username)
logger.error(f"username {username} not found on smf. Unable to determine user id .")
return None
@classmethod
@@ -130,12 +161,12 @@ class SmfManager:
out = {}
for row in rows:
out[row[1]] = row[0]
logger.debug("Got smf groups %s" % out)
logger.debug(f"Got smf groups {out}")
return out
@classmethod
def get_user_groups(cls, userid):
logger.debug("Getting smf user id %s groups" % userid)
logger.debug(f"Getting smf user id {userid} groups")
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_GET_USER_GROUPS, [userid])
out = [row[0] for row in cursor.fetchall()]
@@ -144,8 +175,11 @@ class SmfManager:
@classmethod
def add_user(cls, username, email_address, groups, characterid):
logger.debug("Adding smf user with member_name {}, email_address {}, characterid {}".format(
username, email_address, characterid))
logger.debug(
f"Adding smf user with member_name {username}, "
f"email_address {email_address}, "
f"characterid {characterid}"
)
cursor = connections['smf'].cursor()
username_clean = cls.santatize_username(username)
passwd = cls.generate_random_pass()
@@ -154,42 +188,59 @@ class SmfManager:
register_date = cls.get_current_utc_date()
# check if the username was simply revoked
if cls.check_user(username) is True:
logger.warn("Unable to add smf user with username %s - already exists. Updating user instead." % username)
logger.warning(f"Unable to add smf user with username {username} - already exists. Updating user instead.")
cls.__update_user_info(username_clean, email_address, pwhash)
else:
try:
cursor.execute(cls.SQL_ADD_USER,
[username_clean, passwd, email_address, register_date, username_clean])
smf_version = cls._get_current_smf_version()
if version.parse(smf_version) < version.parse("2.1"):
logger.debug("SMF compatibility: < 2.1")
cursor.execute(
cls.SQL_ADD_USER_SMF_20,
[username_clean, pwhash, email_address, register_date, username_clean]
)
else:
logger.debug("SMF compatibility: >= 2.1")
cursor.execute(
cls.SQL_ADD_USER_SMF_21,
[username_clean, pwhash, email_address, register_date, username_clean]
)
cls.add_avatar(username_clean, characterid)
logger.info("Added smf member_name %s" % username_clean)
logger.info(f"Added smf member_name {username_clean}")
cls.update_groups(username_clean, groups)
except:
logger.warn("Unable to add smf user %s" % username_clean)
except Exception as e:
logger.warning(f"Unable to add smf user {username_clean}: {e}")
pass
return username_clean, passwd
@classmethod
def __update_user_info(cls, username, email_address, passwd):
logger.debug(
f"Updating smf user {username} info: username {email_address} password of length {len(passwd)}")
f"Updating smf user {username} info: "
f"username {email_address} "
f"password of length {len(passwd)}"
)
cursor = connections['smf'].cursor()
try:
cursor.execute(cls.SQL_DIS_USER, [email_address, passwd, username])
logger.info("Updated smf user %s info" % username)
except:
logger.exception("Unable to update smf user %s info." % username)
logger.info(f"Updated smf user {username} info")
except Exception as e:
logger.exception(f"Unable to update smf user {username} info. ({e})")
pass
@classmethod
def delete_user(cls, username):
logger.debug("Deleting smf user %s" % username)
logger.debug(f"Deleting smf user {username}")
cursor = connections['smf'].cursor()
if cls.check_user(username):
cursor.execute(cls.SQL_DEL_USER, [username])
logger.info("Deleted smf user %s" % username)
logger.info(f"Deleted smf user {username}")
return True
logger.error("Unable to delete smf user %s - user not found on smf." % username)
logger.error(f"Unable to delete smf user {username} - user not found on smf.")
return False
@classmethod
@@ -218,8 +269,8 @@ class SmfManager:
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_ADD_USER_GROUP, [groupid, userid])
logger.info(f"Added smf user id {userid} to group id {groupid}")
except:
logger.exception(f"Unable to add smf user id {userid} to group id {groupid}")
except Exception as e:
logger.exception(f"Unable to add smf user id {userid} to group id {groupid} ({e})")
pass
@classmethod
@@ -229,13 +280,13 @@ class SmfManager:
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_REMOVE_USER_GROUP, [groupid, userid])
logger.info(f"Removed smf user id {userid} from group id {groupid}")
except:
logger.exception(f"Unable to remove smf user id {userid} from group id {groupid}")
except Exception as e:
logger.exception(f"Unable to remove smf user id {userid} from group id {groupid} ({e})")
pass
@classmethod
def disable_user(cls, username):
logger.debug("Disabling smf user %s" % username)
logger.debug(f"Disabling smf user {username}")
cursor = connections['smf'].cursor()
password = cls.generate_random_pass()
@@ -245,15 +296,15 @@ class SmfManager:
cursor.execute(cls.SQL_DIS_USER, [revoke_email, pwhash, username])
cls.get_user_id(username)
cls.update_groups(username, [])
logger.info("Disabled smf user %s" % username)
logger.info(f"Disabled smf user {username}")
return True
except TypeError:
logger.exception("TypeError occured while disabling user %s - failed to disable." % username)
logger.exception(f"TypeError occured while disabling user {username} - failed to disable.")
return False
@classmethod
def update_user_password(cls, username, characterid, password=None):
logger.debug("Updating smf user %s password" % username)
logger.debug(f"Updating smf user {username} password")
cursor = connections['smf'].cursor()
if not password:
password = cls.generate_random_pass()
@@ -261,10 +312,12 @@ class SmfManager:
username_clean = cls.santatize_username(username)
pwhash = cls.gen_hash(username_clean, password)
logger.debug(
f"Proceeding to update smf user {username} password with pwhash starting with {pwhash[0:5]}")
f"Proceeding to update smf user {username} "
f"password with pwhash starting with {pwhash[0:5]}"
)
cursor.execute(cls.SQL_UPDATE_USER_PASSWORD, [pwhash, username])
cls.add_avatar(username, characterid)
logger.info("Updated smf user %s password." % username)
logger.info(f"Updated smf user {username} password.")
return password
logger.error("Unable to update smf user %s password - user not found on smf." % username)
logger.error(f"Unable to update smf user {username} password - user not found on smf.")
return ""

View File

@@ -1,5 +1,4 @@
{% extends "admin/change_list.html" %}
{% load static %}
{% load i18n %}
{% block object-tools-items %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Verify Teamspeak" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Fleet Formatter Tool" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Credentials{% endblocktrans %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Password Change{% endblocktrans %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Services Management" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "SRP Fleet Create" %}{% endblock page_title %}

View File

@@ -8,7 +8,7 @@
{% block extra_css %}
{% include 'bundles/datatables-css.html' %}
{% include 'bundles/x-editable.css.html' %}
<link href="{% static 'css/checkbox.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'allianceauth/css/checkbox.css' %}" rel="stylesheet" type="text/css">
<style>
.copy-text-fa-icon:hover {
cursor: pointer;
@@ -30,8 +30,8 @@
width: 95%;
}
.radio, .checkbox {
margin-top: 0px;
margin-bottom: 0px;
margin-top: 0;
margin-bottom: 0;
}
.editable-error-block {
white-space: nowrap;

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% load humanize %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "SRP Request" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}{% translate "Update AAR Link" %}{% endblock page_title %}

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 483 B

View File

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 868 B

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -17,7 +17,7 @@
{% include 'bundles/bootstrap-css.html' %}
{% include 'bundles/fontawesome.html' %}
<link href="{% static 'css/auth-base.css' %}" type="text/css" rel="stylesheet">
<link href="{% static 'allianceauth/css/auth-base.css' %}" type="text/css" rel="stylesheet">
{% block extra_css %}{% endblock extra_css %}
</head>
@@ -49,8 +49,8 @@
userNotificationsCountViewUrl: "{% url 'notifications:user_notifications_count' request.user.pk %}"
};
</script>
<script src="{% static 'js/refresh_notifications.js' %}"></script>
<script src="{% static 'js/eve-time.js' %}"></script>
{% include 'bundles/refresh-notifications-js.html' %}
{% include 'bundles/evetime-js.html' %}
{% block extra_javascript %}
{% endblock extra_javascript %}

View File

@@ -1,5 +1,5 @@
{% load static %}
<link rel="icon" type="image/png" href="{% static 'icons/favicon-16x16.png' %}" sizes="16x16">
<link rel="icon" type="image/png" href="{% static 'icons/favicon-32x32.png' %}" sizes="32x32">
<link rel="icon" type="image/png" href="{% static 'icons/favicon-96x96.png' %}" sizes="96x96">
<link rel="apple-touch-icon" href="{% static 'icons/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" href="{% static 'allianceauth/icons/favicon-16x16.png' %}" sizes="16x16">
<link rel="icon" type="image/png" href="{% static 'allianceauth/icons/favicon-32x32.png' %}" sizes="32x32">
<link rel="icon" type="image/png" href="{% static 'allianceauth/icons/favicon-96x96.png' %}" sizes="96x96">
<link rel="apple-touch-icon" href="{% static 'allianceauth/icons/apple-touch-icon.png' %}">

View File

@@ -12,7 +12,7 @@
</button>
<a class="navbar-brand">
<img src="{% static 'icons/favicon-32x32.png' %}" style="display: inline-block;" height="32" width="32"/>
<img src="{% static 'allianceauth/icons/favicon-32x32.png' %}" style="display: inline-block;" height="32" width="32"/>
{{ SITE_NAME }}
</a>
</div>

View File

@@ -3,17 +3,17 @@
{% if NIGHT_MODE %}
{% if debug %}
<!-- In template debug, loading less file instead of CSS -->
<link rel="stylesheet/less" type="text/css" href="{% static 'css/themes/darkly/darkly.less' %}">
<link rel="stylesheet/less" type="text/css" href="{% static 'allianceauth/css/themes/darkly/darkly.less' %}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/4.1.2/less.min.js" integrity="sha512-eXBn7AaMbUOWb3PSDhwcjByoM89FeO1SF9Jww6kqPYQkBrGZvqAKFbtqLHh5O95rYA/AOtWZ0QRO2S6rP+KsUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> {% else %}
<link rel="stylesheet" type="text/css" href="{% static 'css/themes/darkly/darkly.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'allianceauth/css/themes/darkly/darkly.min.css' %}">
{% endif %}
{% else %}
{% if debug %}
<!-- In template debug, loading less file instead of CSS -->
<link rel="stylesheet/less" type="text/css" href="{% static 'css/themes/flatly/flatly.less' %}">
<link rel="stylesheet/less" type="text/css" href="{% static 'allianceauth/css/themes/flatly/flatly.less' %}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/4.1.2/less.min.js" integrity="sha512-eXBn7AaMbUOWb3PSDhwcjByoM89FeO1SF9Jww6kqPYQkBrGZvqAKFbtqLHh5O95rYA/AOtWZ0QRO2S6rP+KsUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% else %}
<link rel="stylesheet" type="text/css" href="{% static 'css/themes/flatly/flatly.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'allianceauth/css/themes/flatly/flatly.min.css' %}">
{% endif %}
{% endif %}
<!-- End Bootstrap CSS -->

View File

@@ -0,0 +1,3 @@
{% load static %}
<script src="{% static 'allianceauth/js/eve-time.js' %}"></script>

View File

@@ -0,0 +1,3 @@
{% load static %}
<script type="application/javascript" src="{% static 'allianceauth/js/filterDropDown/filterDropDown.min.js' %}"></script>

View File

@@ -1,5 +1,5 @@
{% load static %}
<!-- Start jQuery UI CSS from Alliance Auth -->
<!-- CDNs all contain theme.css, which is not supposed to be in the base CSS, Which is why this is uniquely bundled in not using a CDN -->
<link rel="stylesheet" href="{% static 'js/jquery-ui/1.12.1/css/jquery-ui.min.css' %}" integrity="sha512-7smZe1765O+Mm1UZH46SzaFClbRX7dEs01lB9lqU91oocmugWWfQXVQNVr5tEwktYSqwJMErEfr4GvflXMgTPA==" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="{% static 'allianceauth/js/jquery-ui/1.12.1/css/jquery-ui.min.css' %}" integrity="sha512-7smZe1765O+Mm1UZH46SzaFClbRX7dEs01lB9lqU91oocmugWWfQXVQNVr5tEwktYSqwJMErEfr4GvflXMgTPA==" crossorigin="anonymous" referrerpolicy="no-referrer">
<!-- End jQuery UI CSS from aa-gdpr -->

View File

@@ -1,4 +1,3 @@
{% load static %}
<!-- Start jQuery visibility js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-visibility/1.0.11/jquery-visibility.min.js" integrity="sha512-kL8M4N4KLFJ4ydyfbBiXU1InCR6zs8jm8NR1BXykgFmMhVO3RS9bvoMHnVwoPe+i6NRvfydNlweatKee85Df3A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- End jQuery visibility js -->

View File

@@ -0,0 +1,3 @@
{% load static %}
<script src="{% static 'allianceauth/js/refresh_notifications.js' %}"></script>

View File

@@ -0,0 +1,3 @@
{% load static %}
<script src="{% static 'allianceauth/js/timers.js' %}"></script>

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
{% block page_title %}

View File

@@ -539,7 +539,7 @@
</div>
{% include 'bundles/moment-js.html' with locale=True %}
<script src="{% static 'js/timers.js' %}"></script>
{% include 'bundles/timers-js.html' %}
<script type="application/javascript">
let timers = [
{% for timer in timers %}

View File

Some files were not shown because too many files have changed in this diff Show More