Light12306/Web12306/js/platform/securityCheck.js
2015-07-08 17:24:45 +08:00

63 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

define(function (require, exports, module) {
var isAdmin = false;
exports.checkIllegalUserName = function (nickname) {
if (isAdmin)
return null;
if (/(管理|木[鱼魚]|刷.*?票|系.*统)/g.test(nickname)) {
return "无效用户名!";
}
return null;
};
exports.checkIllegalWords = function (value) {
if (isAdmin)
return null;
if (value.length > 900) {
return "亲,你的话太多啦,少说点儿呗。";
}
if (_.some([
[/https?:\/\/.+/]
], function (array) {
return _.all(array, function (exp) { return exp.test(value); });
}))
return "很抱歉,本平台不接受发送网址类信息。";
if (_.some([
[/1[\d\s]{10}/i],
[/求/, /联系/, /\d+/],
[/心/, /蓝/],
[/[三3③叁].*?[六陆⑥6].*?[0零oO]/],
[/[求]/, /黄.*?牛/],
[/联.*?系.*?我/],
[/[\d①②③④⑤⑥⑦⑧⑨零一二三四五六七八九\s=,\.=:、\-——]{7,}/]
], function (array) {
return _.all(array, function (exp) { return exp.test(value); });
}))
return "为保护您的隐私以及正常的秩序,请勿泄露您的个人隐私以及禁止出现的信息。";
if (_.some([
[/[求转购].*?\d+\s*张/]
], function (array) {
return _.all(array, function (exp) { return exp.test(value); });
}))
return "很抱歉,本平台谢绝任何加价代购、倒卖、求购类信息。";
return null;
};
Object.defineProperty(exports, "isAdmin", {
get: function () {
return isAdmin;
},
set: function (value) {
isAdmin = value;
}
});
});