Ticket #8249: trac_8249-notebook_cookies.2.patch

File trac_8249-notebook_cookies.2.patch, 1.9 KB (added by mpatel, 9 years ago)

Adjust close_callback to make Se tests pass. Apply only this patch.

  • sagenb/data/sage/js/notebook_lib.js

    # HG changeset patch
    # User Mitesh Patel <qed777@gmail.com>
    # Date 1266219028 28800
    # Node ID ebfea69aed5921ead0a27d0fa79cdc08081e7762
    # Parent  d74bcdcb982716008dac1cccd46a5f510950a08b
    #8249: Expire the notebook test and session cookies on logout
    
    diff --git a/sagenb/data/sage/js/notebook_lib.js b/sagenb/data/sage/js/notebook_lib.js
    a b function close_callback(status, response 
    16191619        alert(response_text);
    16201620        return;
    16211621    }
    1622     window.location.replace('/');
     1622    window.location.replace('/home/' + user_name);
    16231623}
    16241624
    16251625
  • sagenb/notebook/twist.py

    diff --git a/sagenb/notebook/twist.py b/sagenb/notebook/twist.py
    a b class RedirectLogin(resource.PostableRes 
    24062406    def childFactory(self, request, name):
    24072407        return RedirectLogin()
    24082408
     2409class LogoutRedirectLogin(resource.PostableResource):
     2410    def render(self, ctx):
     2411        response = http.RedirectResponse('/')
     2412
     2413        # Force cookie deletion.
     2414        yesterday = time.time() - 3600 * 24
     2415        c1 = http_headers.Cookie('nb_session_%s' % notebook.port, '',
     2416                                 expires=yesterday)
     2417        c2 = http_headers.Cookie('cookie_test_%s' % notebook.port, '',
     2418                                 expires=yesterday)
     2419        response.headers.setHeader("set-cookie", [c1, c2])
     2420
     2421        return response
     2422
     2423    def childFactory(self, request, name):
     2424        return LogoutRedirectLogin()
     2425
    24092426import sagenb.simple.twist
    24102427
    24112428class Toplevel(resource.PostableResource):
    class AnonymousToplevel(Toplevel): 
    24552472    child_css = CSS()
    24562473    child_javascript = Javascript()
    24572474    child_java = Java()
    2458     child_logout = RedirectLogin()
     2475    child_logout = LogoutRedirectLogin()
    24592476
    24602477    def userchildFactory(self, request, name):
    24612478        # This is called from Toplevel above