mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-20 06:08:35 +02:00
Simple hack to catch redirections after an ajax request. It is not a clean and perfect solution but it should address most cases.
fix #181
This commit is contained in:
+8
-1
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
from django.http import Http404
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from modoboa.admin.models import Extension
|
||||
|
||||
class ExtControlMiddleware(object):
|
||||
@@ -15,3 +15,10 @@ class ExtControlMiddleware(object):
|
||||
if ext.enabled:
|
||||
return None
|
||||
raise Http404
|
||||
|
||||
class AjaxLoginRedirect(object):
|
||||
def process_response(self, request, response):
|
||||
if request.is_ajax():
|
||||
if type(response) == HttpResponseRedirect:
|
||||
response.status_code = 278
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user