ajax-error.js 591 Bytes
Newer Older
1
$(document).ajaxError(function(event, jXHR) {
polesye committed
2 3
    if (jXHR.status === 403 && jXHR.responseText === 'Unauthenticated') {
        var message = gettext(
4 5 6
            'You have been logged out of your edX account. ' +
            'Click Okay to log in again now. ' +
            'Click Cancel to stay on this page ' +
polesye committed
7 8 9 10
            '(you must log in again to save your work).'
        );

        if (window.confirm(message)) {
11 12
            var currentLocation = window.location.pathname;
            window.location.href = '/login?next=' + encodeURIComponent(currentLocation);
13
        }
polesye committed
14 15
    }
});