Ticket #8127: csrf_middleware_ajax_flash_patch.diff

File csrf_middleware_ajax_flash_patch.diff, 824 bytes (added by herrstagl, 16 years ago)

patch which allows to provide a session id within a post request: userfull for flash based uploaders where authentication is required (done for www.xipax.com)

  • middleware.py

     
    4343    def process_request(self, request):
    4444        if request.method == 'POST':
    4545            try:
    46                 session_id = request.COOKIES[settings.SESSION_COOKIE_NAME]
     46                session_id = request.POST['session_id']
    4747            except KeyError:
    48                 # No session, no check required
    49                 return None
     48                try:
     49                    session_id = request.COOKIES[settings.SESSION_COOKIE_NAME]
     50                except KeyError:
     51                    # No session, no check required
     52                    return None
    5053
    5154            csrf_token = _make_token(session_id)
    5255            # check incoming token
Back to Top