mirror of
https://github.com/moodle/moodle.git
synced 2025-03-21 08:00:37 +01:00
MDL-65794 core: no need for sesskey when login not required
This commit is contained in:
parent
f7e108438f
commit
7fa4e41052
2
lib/amd/build/ajax.min.js
vendored
2
lib/amd/build/ajax.min.js
vendored
@ -1 +1 @@
|
||||
define(["jquery","core/config","core/log","core/url"],function(a,b,c,d){var e=!1,f=function(a){var b,c,e,f=this,g=null,h=0;if(a.error)for(;h<f.length;h++)b=f[h],b.deferred.reject(a);else{for(h=0;h<f.length;h++){if(b=f[h],c=a[h],"undefined"==typeof c){g=new Error("missing response");break}if(c.error!==!1){g=c.exception,e=f[h].nosessionupdate;break}b.deferred.resolve(c.data)}null!==g&&("servicerequireslogin"!==g.errorcode||e?f.forEach(function(a){a.deferred.reject(g)}):window.location=d.relativeUrl("/login/index.php"))}},g=function(a,b,d){var f=this,g=0;for(g=0;g<f.length;g++){var h=f[g];e?(c.error("Page unloaded."),c.error(d)):h.deferred.reject(d)}};return{call:function(c,d,h,i,j){a(window).bind("beforeunload",function(){e=!0});var k,l=[],m=[],n=[],o="";for("undefined"==typeof h&&(h=!0),"undefined"==typeof d&&(d=!0),"undefined"==typeof j&&(j=0),"undefined"==typeof i&&(i=!1),k=0;k<c.length;k++){var p=c[k];l.push({index:k,methodname:p.methodname,args:p.args}),p.nosessionupdate=i,p.deferred=a.Deferred(),m.push(p.deferred.promise()),"undefined"!=typeof p.done&&p.deferred.done(p.done),"undefined"!=typeof p.fail&&p.deferred.fail(p.fail),p.index=k,n.push(p.methodname)}o=n.length<=5?n.sort().join():n.length+"-method-calls",l=JSON.stringify(l);var q={type:"POST",data:l,context:c,dataType:"json",processData:!1,async:d,contentType:"application/json",timeout:j},r="service.php";h||(r="service-nologin.php");var s=b.wwwroot+"/lib/ajax/"+r+"?sesskey="+b.sesskey+"&info="+o;return i&&(s+="&nosessionupdate=true"),d?a.ajax(s,q).done(f).fail(g):(q.success=f,q.error=g,a.ajax(s,q)),m}}});
|
||||
define(["jquery","core/config","core/log","core/url"],function(a,b,c,d){var e=!1,f=function(a){var b,c,e,f=this,g=null,h=0;if(a.error)for(;h<f.length;h++)b=f[h],b.deferred.reject(a);else{for(h=0;h<f.length;h++){if(b=f[h],c=a[h],"undefined"==typeof c){g=new Error("missing response");break}if(c.error!==!1){g=c.exception,e=f[h].nosessionupdate;break}b.deferred.resolve(c.data)}null!==g&&("servicerequireslogin"!==g.errorcode||e?f.forEach(function(a){a.deferred.reject(g)}):window.location=d.relativeUrl("/login/index.php"))}},g=function(a,b,d){var f=this,g=0;for(g=0;g<f.length;g++){var h=f[g];e?(c.error("Page unloaded."),c.error(d)):h.deferred.reject(d)}};return{call:function(c,d,h,i,j){a(window).bind("beforeunload",function(){e=!0});var k,l=[],m=[],n=[],o="";for("undefined"==typeof h&&(h=!0),"undefined"==typeof d&&(d=!0),"undefined"==typeof j&&(j=0),"undefined"==typeof i&&(i=!1),k=0;k<c.length;k++){var p=c[k];l.push({index:k,methodname:p.methodname,args:p.args}),p.nosessionupdate=i,p.deferred=a.Deferred(),m.push(p.deferred.promise()),"undefined"!=typeof p.done&&p.deferred.done(p.done),"undefined"!=typeof p.fail&&p.deferred.fail(p.fail),p.index=k,n.push(p.methodname)}o=n.length<=5?n.sort().join():n.length+"-method-calls",l=JSON.stringify(l);var q={type:"POST",data:l,context:c,dataType:"json",processData:!1,async:d,contentType:"application/json",timeout:j},r="service.php",s=b.wwwroot+"/lib/ajax/";return h?s+=r+"?sesskey="+b.sesskey+"&info="+o:(r="service-nologin.php",s+=r+"?info="+o),i&&(s+="&nosessionupdate=true"),d?a.ajax(s,q).done(f).fail(g):(q.success=f,q.error=g,a.ajax(s,q)),m}}});
|
@ -203,11 +203,13 @@ define(['jquery', 'core/config', 'core/log', 'core/url'], function($, config, Lo
|
||||
};
|
||||
|
||||
var script = 'service.php';
|
||||
var url = config.wwwroot + '/lib/ajax/';
|
||||
if (!loginrequired) {
|
||||
script = 'service-nologin.php';
|
||||
url += script + '?info=' + requestInfo;
|
||||
} else {
|
||||
url += script + '?sesskey=' + config.sesskey + '&info=' + requestInfo;
|
||||
}
|
||||
var url = config.wwwroot + '/lib/ajax/' + script +
|
||||
'?sesskey=' + config.sesskey + '&info=' + requestInfo;
|
||||
|
||||
if (nosessionupdate) {
|
||||
url += '&nosessionupdate=true';
|
||||
|
Loading…
x
Reference in New Issue
Block a user