From 953ddd82e48dd206cef5ac94456549aed13b3ad5 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Fri, 17 Nov 2023 23:25:29 +0100 Subject: Updated 30 files and deleted 2976 files (automated) --- .../node_modules/validator/lib/isEmail.js | 203 --------------------- 1 file changed, 203 deletions(-) delete mode 100644 includes/external/addressbook/node_modules/validator/lib/isEmail.js (limited to 'includes/external/addressbook/node_modules/validator/lib/isEmail.js') diff --git a/includes/external/addressbook/node_modules/validator/lib/isEmail.js b/includes/external/addressbook/node_modules/validator/lib/isEmail.js deleted file mode 100644 index 55609ba..0000000 --- a/includes/external/addressbook/node_modules/validator/lib/isEmail.js +++ /dev/null @@ -1,203 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isEmail; - -var _assertString = _interopRequireDefault(require("./util/assertString")); - -var _merge = _interopRequireDefault(require("./util/merge")); - -var _isByteLength = _interopRequireDefault(require("./isByteLength")); - -var _isFQDN = _interopRequireDefault(require("./isFQDN")); - -var _isIP = _interopRequireDefault(require("./isIP")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var default_email_options = { - allow_display_name: false, - require_display_name: false, - allow_utf8_local_part: true, - require_tld: true, - blacklisted_chars: '', - ignore_max_length: false, - host_blacklist: [], - host_whitelist: [] -}; -/* eslint-disable max-len */ - -/* eslint-disable no-control-regex */ - -var splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)]/.test(display_name_without_quotes); - - if (contains_illegal) { - // if contains illegal characters, - // must to be enclosed in double-quotes, otherwise it's not a valid display name - if (display_name_without_quotes === display_name) { - return false; - } // the quotes in display name must start with character symbol \ - - - var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length; - - if (!all_start_with_back_slash) { - return false; - } - } - - return true; -} - -function isEmail(str, options) { - (0, _assertString.default)(str); - options = (0, _merge.default)(options, default_email_options); - - if (options.require_display_name || options.allow_display_name) { - var display_email = str.match(splitNameAddress); - - if (display_email) { - var display_name = display_email[1]; // Remove display name and angle brackets to get email address - // Can be done in the regex but will introduce a ReDOS (See #1597 for more info) - - str = str.replace(display_name, '').replace(/(^<|>$)/g, ''); // sometimes need to trim the last space to get the display name - // because there may be a space between display name and email address - // eg. myname - // the display name is `myname` instead of `myname `, so need to trim the last space - - if (display_name.endsWith(' ')) { - display_name = display_name.slice(0, -1); - } - - if (!validateDisplayName(display_name)) { - return false; - } - } else if (options.require_display_name) { - return false; - } - } - - if (!options.ignore_max_length && str.length > defaultMaxEmailLength) { - return false; - } - - var parts = str.split('@'); - var domain = parts.pop(); - var lower_domain = domain.toLowerCase(); - - if (options.host_blacklist.includes(lower_domain)) { - return false; - } - - if (options.host_whitelist.length > 0 && !options.host_whitelist.includes(lower_domain)) { - return false; - } - - var user = parts.join('@'); - - if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) { - /* - Previously we removed dots for gmail addresses before validating. - This was removed because it allows `multiple..dots@gmail.com` - to be reported as valid, but it is not. - Gmail only normalizes single dots, removing them from here is pointless, - should be done in normalizeEmail - */ - user = user.toLowerCase(); // Removing sub-address from username before gmail validation - - var username = user.split('+')[0]; // Dots are not included in gmail length restriction - - if (!(0, _isByteLength.default)(username.replace(/\./g, ''), { - min: 6, - max: 30 - })) { - return false; - } - - var _user_parts = username.split('.'); - - for (var i = 0; i < _user_parts.length; i++) { - if (!gmailUserPart.test(_user_parts[i])) { - return false; - } - } - } - - if (options.ignore_max_length === false && (!(0, _isByteLength.default)(user, { - max: 64 - }) || !(0, _isByteLength.default)(domain, { - max: 254 - }))) { - return false; - } - - if (!(0, _isFQDN.default)(domain, { - require_tld: options.require_tld, - ignore_max_length: options.ignore_max_length - })) { - if (!options.allow_ip_domain) { - return false; - } - - if (!(0, _isIP.default)(domain)) { - if (!domain.startsWith('[') || !domain.endsWith(']')) { - return false; - } - - var noBracketdomain = domain.slice(1, -1); - - if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) { - return false; - } - } - } - - if (user[0] === '"') { - user = user.slice(1, user.length - 1); - return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user); - } - - var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart; - var user_parts = user.split('.'); - - for (var _i = 0; _i < user_parts.length; _i++) { - if (!pattern.test(user_parts[_i])) { - return false; - } - } - - if (options.blacklisted_chars) { - if (user.search(new RegExp("[".concat(options.blacklisted_chars, "]+"), 'g')) !== -1) return false; - } - - return true; -} - -module.exports = exports.default; -module.exports.default = exports.default; \ No newline at end of file -- cgit