diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-10 14:18:08 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-13 08:27:43 +0200 |
commit | c624c102a6edbe51256aaf5c0025ff6331018f32 (patch) | |
tree | 224082375cd3a6c433d6f3481e548e99ed8a47a6 /core/src/jquery | |
parent | 0b136d28a3ab9a14f1a001c0bc8ca15d4a4abf4a (diff) | |
download | nextcloud-server-c624c102a6edbe51256aaf5c0025ff6331018f32.tar.gz nextcloud-server-c624c102a6edbe51256aaf5c0025ff6331018f32.zip |
Move OC.requestToken to the bundle, deprecate oc_requesttoken
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src/jquery')
-rw-r--r-- | core/src/jquery/index.js | 1 | ||||
-rw-r--r-- | core/src/jquery/requesttoken.js | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/core/src/jquery/index.js b/core/src/jquery/index.js index 43b379fd2e5..e2efc76bdf1 100644 --- a/core/src/jquery/index.js +++ b/core/src/jquery/index.js @@ -28,6 +28,7 @@ import './filterattr' import './ocdialog' import './octemplate' import './placeholder' +import './requesttoken' import './selectrange' import './showpassword' import './tipsy' diff --git a/core/src/jquery/requesttoken.js b/core/src/jquery/requesttoken.js new file mode 100644 index 00000000000..a8fb024d04a --- /dev/null +++ b/core/src/jquery/requesttoken.js @@ -0,0 +1,31 @@ +/* + * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import $ from 'jquery' + +import {getToken} from '../OC/requesttoken' + +$(document).on('ajaxSend',function(elm, xhr, settings) { + if(settings.crossDomain === false) { + xhr.setRequestHeader('requesttoken', getToken()); + xhr.setRequestHeader('OCS-APIREQUEST', 'true'); + } +}); |