Ticket #15755: admin.diff

File admin.diff, 1.5 KB (added by metzen, 4 years ago)
  • conf/global_settings.py

     
    484484# The number of days a password reset link is valid for
    485485PASSWORD_RESET_TIMEOUT_DAYS = 3
    486486
     487# Whether the admin app should handle user authentication.
     488ADMIN_HANDLE_LOGINS = True
     489
    487490########
    488491# CSRF #
    489492########
  • contrib/admin/sites.py

     
    77from django.contrib.contenttypes import views as contenttype_views
    88from django.views.decorators.csrf import csrf_protect
    99from django.db.models.base import ModelBase
    10 from django.core.exceptions import ImproperlyConfigured
     10from django.core.exceptions import ImproperlyConfigured, PermissionDenied
    1111from django.core.urlresolvers import reverse
    1212from django.shortcuts import render_to_response
    1313from django.utils.safestring import mark_safe
     
    193193        """
    194194        def inner(request, *args, **kwargs):
    195195            if not self.has_permission(request):
    196                 return self.login(request)
     196                if settings.ADMIN_HANDLE_LOGINS:
     197                    return self.login(request)
     198                else:
     199                    raise PermissionDenied
    197200            return view(request, *args, **kwargs)
    198201        if not cacheable:
    199202            inner = never_cache(inner)
Back to Top