Autologin
Some checks are pending
Docker hub build / docker (push) Waiting to run

This commit is contained in:
A B
2024-10-28 00:06:35 +00:00
parent b6ad6e8578
commit 7cf99af20d
5 changed files with 33 additions and 18 deletions

View File

@@ -19,6 +19,11 @@ from .server_plugins import (
OutlineServerAdmin)
admin.site.site_title = "VPN Manager"
admin.site.site_header = "VPN Manager"
admin.site.index_title = "OutFleet"
@admin.register(Server)
class ServerAdmin(PolymorphicParentModelAdmin):
base_model = Server

View File

@@ -1,6 +1,7 @@
from django.apps import AppConfig
from django.contrib.auth import get_user_model
class VPN(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'vpn'

View File

@@ -0,0 +1,17 @@
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
class Command(BaseCommand):
help = 'Create default admin user'
def handle(self, *args, **kwargs):
User = get_user_model()
if not User.objects.filter(username='admin').exists():
User.objects.create_superuser(
username='admin',
password='admin',
email='admin@localhost'
)
self.stdout.write(self.style.SUCCESS('Admin user created'))
else:
self.stdout.write(self.style.WARNING('Admin user already exists'))