ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([], function () {
'use strict';
return {
/**
* Redirects to the url if it is considered safe
*
* @param {String} path - url to be redirected to
*/
redirect: function (path) {
path = this.sanitize(path);
if (this.validate(path)) {
window.location.href = path;
}
},
/**
* Validates url
*
* @param {Object} path - url to be validated
* @returns {Boolean}
*/
validate: function (path) {
var hostname = window.location.hostname;
if (path.indexOf(hostname) === -1 ||
path.indexOf('javascript:') !== -1 ||
path.indexOf('vbscript:') !== -1) {
return false;
}
return true;
},
/**
* Sanitize url, replacing disallowed chars
*
* @param {String} path - url to be normalized
* @returns {String}
*/
sanitize: function (path) {
return path.replace('[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]', '');
}
};
});