mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-21 05:49:37 +02:00
Enhance admin security by integrating secure_admin_login from AllAuth and updating settings for new dependencies
This commit is contained in:
parent
f119e6fdc2
commit
b86c7258e7
5 changed files with 22 additions and 3 deletions
|
@ -3,6 +3,11 @@ from django.contrib import admin
|
||||||
from django.utils.html import mark_safe
|
from django.utils.html import mark_safe
|
||||||
from .models import Adventure, Checklist, ChecklistItem, Collection, Transportation, Note, AdventureImage, Visit, Category
|
from .models import Adventure, Checklist, ChecklistItem, Collection, Transportation, Note, AdventureImage, Visit, Category
|
||||||
from worldtravel.models import Country, Region, VisitedRegion
|
from worldtravel.models import Country, Region, VisitedRegion
|
||||||
|
from allauth.account.decorators import secure_admin_login
|
||||||
|
|
||||||
|
admin.autodiscover()
|
||||||
|
admin.site.login = secure_admin_login(admin.site.login)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AdventureAdmin(admin.ModelAdmin):
|
class AdventureAdmin(admin.ModelAdmin):
|
||||||
|
|
|
@ -47,10 +47,13 @@ INSTALLED_APPS = (
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework.authtoken',
|
'rest_framework.authtoken',
|
||||||
|
"allauth_ui",
|
||||||
'allauth',
|
'allauth',
|
||||||
'allauth.account',
|
'allauth.account',
|
||||||
'allauth.headless',
|
'allauth.headless',
|
||||||
'allauth.socialaccount',
|
'allauth.socialaccount',
|
||||||
|
"widget_tweaks",
|
||||||
|
"slippers",
|
||||||
'drf_yasg',
|
'drf_yasg',
|
||||||
'corsheaders',
|
'corsheaders',
|
||||||
'adventures',
|
'adventures',
|
||||||
|
@ -119,6 +122,9 @@ USE_L10N = True
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
|
ALLAUTH_UI_THEME = "dark"
|
||||||
|
SILENCED_SYSTEM_CHECKS = ["slippers.E001"]
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
||||||
|
|
||||||
|
|
|
@ -13,4 +13,7 @@ whitenoise
|
||||||
django-resized
|
django-resized
|
||||||
django-geojson
|
django-geojson
|
||||||
setuptools
|
setuptools
|
||||||
gunicorn==23.0.0
|
gunicorn==23.0.0
|
||||||
|
slippers==0.6.2
|
||||||
|
django-allauth-ui==1.5.1
|
||||||
|
django-widget-tweaks==1.5.0
|
|
@ -1,7 +1,10 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from allauth.account.decorators import secure_admin_login
|
||||||
from django.contrib.sessions.models import Session
|
from django.contrib.sessions.models import Session
|
||||||
|
|
||||||
|
admin.autodiscover()
|
||||||
|
admin.site.login = secure_admin_login(admin.site.login)
|
||||||
|
|
||||||
class SessionAdmin(admin.ModelAdmin):
|
class SessionAdmin(admin.ModelAdmin):
|
||||||
def _session_data(self, obj):
|
def _session_data(self, obj):
|
||||||
return obj.get_decoded()
|
return obj.get_decoded()
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from allauth.account.decorators import secure_admin_login
|
||||||
|
|
||||||
# Register your models here.
|
admin.autodiscover()
|
||||||
|
admin.site.login = secure_admin_login(admin.site.login)
|
Loading…
Add table
Add a link
Reference in a new issue