Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@accounts/common

Package Overview
Dependencies
Maintainers
5
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accounts/common - npm Package Compare versions

Comparing version 0.0.8-alpha.840bab8d to 0.0.8-alpha.bba71456

lib-es6/config.js

344

lib/index.js

@@ -1,35 +0,335 @@

'use strict';
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("lodash"), require("babel-runtime/core-js/json/stringify"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"));
else if(typeof define === 'function' && define.amd)
define(["lodash", "babel-runtime/core-js/json/stringify", "babel-runtime/core-js/object/get-prototype-of", "babel-runtime/helpers/classCallCheck", "babel-runtime/helpers/createClass", "babel-runtime/helpers/possibleConstructorReturn", "babel-runtime/helpers/inherits"], factory);
else if(typeof exports === 'object')
exports["@accounts/common"] = factory(require("lodash"), require("babel-runtime/core-js/json/stringify"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"));
else
root["@accounts/common"] = factory(root["lodash"], root["babel-runtime/core-js/json/stringify"], root["babel-runtime/core-js/object/get-prototype-of"], root["babel-runtime/helpers/classCallCheck"], root["babel-runtime/helpers/createClass"], root["babel-runtime/helpers/possibleConstructorReturn"], root["babel-runtime/helpers/inherits"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_7__, __WEBPACK_EXTERNAL_MODULE_8__, __WEBPACK_EXTERNAL_MODULE_9__, __WEBPACK_EXTERNAL_MODULE_10__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.config = exports.toUsernameAndEmail = exports.AccountsError = exports.validators = exports.PasswordSignupFields = undefined;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
var _passwordSignupFields = require('./passwordSignupFields');
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
var PasswordSignupFields = _interopRequireWildcard(_passwordSignupFields);
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
var _validators = require('./validators');
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
var validators = _interopRequireWildcard(_validators);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
var _errors = require('./errors');
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
var _toUsernameAndEmail = require('./toUsernameAndEmail');
var _toUsernameAndEmail2 = _interopRequireDefault(_toUsernameAndEmail);
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
var _config = require('./config');
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
var _config2 = _interopRequireDefault(_config);
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
'use strict';
exports.PasswordSignupFields = PasswordSignupFields;
exports.validators = validators;
exports.AccountsError = _errors.AccountsError;
exports.toUsernameAndEmail = _toUsernameAndEmail2.default;
exports.config = _config2.default;
/* eslint-disable import/no-named-as-default */
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.config = exports.toUsernameAndEmail = exports.AccountsError = exports.validators = exports.PasswordSignupFields = undefined;
var _passwordSignupFields = __webpack_require__(1);
var PasswordSignupFields = _interopRequireWildcard(_passwordSignupFields);
var _validators = __webpack_require__(2);
var validators = _interopRequireWildcard(_validators);
var _errors = __webpack_require__(4);
var _toUsernameAndEmail = __webpack_require__(11);
var _toUsernameAndEmail2 = _interopRequireDefault(_toUsernameAndEmail);
var _config = __webpack_require__(12);
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
exports.PasswordSignupFields = PasswordSignupFields;
exports.validators = validators;
exports.AccountsError = _errors.AccountsError;
exports.toUsernameAndEmail = _toUsernameAndEmail2.default;
exports.config = _config2.default;
/* eslint-disable import/no-named-as-default */
/***/ },
/* 1 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var EMAIL_ONLY = exports.EMAIL_ONLY = 'EMAIL_ONLY';
var USERNAME_AND_EMAIL = exports.USERNAME_AND_EMAIL = 'USERNAME_AND_EMAIL';
var USERNAME_AND_OPTIONAL_EMAIL = exports.USERNAME_AND_OPTIONAL_EMAIL = 'USERNAME_AND_OPTIONAL_EMAIL';
var USERNAME_ONLY = exports.USERNAME_ONLY = 'USERNAME_ONLY';
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validateUsername = exports.validatePassword = exports.validateEmail = exports.isEmail = undefined;
var _lodash = __webpack_require__(3);
var isEmail = exports.isEmail = function isEmail(email) {
// eslint-disable-next-line
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return email && re.test(email);
};
var validateEmail = exports.validateEmail = function validateEmail(email) {
var isValid = !(0, _lodash.isEmpty)((0, _lodash.trim)(email || '')) && isEmail(email);
return isValid;
};
var validatePassword = exports.validatePassword = function validatePassword(password) {
var isValid = !(0, _lodash.isEmpty)(password);
return isValid;
};
var validateUsername = exports.validateUsername = function validateUsername(username) {
var usernameRegex = /^[a-zA-Z][a-zA-Z0-9]*$/;
var isValid = username && !(0, _lodash.isEmpty)((0, _lodash.trim)(username)) && usernameRegex.test(username);
return isValid;
};
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = require("lodash");
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AccountsError = undefined;
var _stringify = __webpack_require__(5);
var _stringify2 = _interopRequireDefault(_stringify);
var _getPrototypeOf = __webpack_require__(6);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(7);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(8);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(9);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(10);
var _inherits3 = _interopRequireDefault(_inherits2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// eslint-disable-next-line import/prefer-default-export
var AccountsError = exports.AccountsError = function (_Error) {
(0, _inherits3.default)(AccountsError, _Error);
function AccountsError(message, loginInfo, errorCode) {
(0, _classCallCheck3.default)(this, AccountsError);
var _this = (0, _possibleConstructorReturn3.default)(this, (AccountsError.__proto__ || (0, _getPrototypeOf2.default)(AccountsError)).call(this, message));
_this.epochTime = Date.now();
if (loginInfo) {
_this.loginInfo = loginInfo;
}
if (errorCode) {
_this.errorCode = errorCode;
}
return _this;
}
(0, _createClass3.default)(AccountsError, [{
key: 'toString',
value: function toString() {
try {
return (0, _stringify2.default)({
message: this.message,
loginInfo: this.loginInfo,
errorCode: this.errorCode,
epochTime: this.epochTime
});
} catch (e) {
return 'Error was thrown but could not be serialized. ' + 'Make sure there is no circular references parameters passed to constructor';
}
}
}, {
key: 'serialize',
value: function serialize() {
return this.toString();
}
}]);
return AccountsError;
}(Error);
/***/ },
/* 5 */
/***/ function(module, exports) {
module.exports = require("babel-runtime/core-js/json/stringify");
/***/ },
/* 6 */
/***/ function(module, exports) {
module.exports = require("babel-runtime/core-js/object/get-prototype-of");
/***/ },
/* 7 */
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/classCallCheck");
/***/ },
/* 8 */
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/createClass");
/***/ },
/* 9 */
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/possibleConstructorReturn");
/***/ },
/* 10 */
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/inherits");
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _validators = __webpack_require__(2);
/**
* Given a username, user and/or email figure out the username and/or email.
*
* @param {Object} An object containing at least `username`, `user` and/or `email`.
* @returns {Object} An object containing `username` and `email`.
*/
var toUsernameAndEmail = function toUsernameAndEmail(_ref) {
var user = _ref.user,
username = _ref.username,
email = _ref.email,
id = _ref.id;
if (user && !username && !email) {
if ((0, _validators.isEmail)(user)) {
email = user; // eslint-disable-line no-param-reassign
username = null; // eslint-disable-line no-param-reassign
} else {
username = user; // eslint-disable-line no-param-reassign
email = null; // eslint-disable-line no-param-reassign
}
}
return { username: username, email: email, id: id };
};
exports.default = toUsernameAndEmail;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _passwordSignupFields = __webpack_require__(1);
// eslint-disable-next-line import/no-named-as-default
exports.default = {
siteUrl: 'http://localhost:3000',
sendVerificationEmail: false,
sendEnrollmentEmail: false,
sendWelcomeEmail: false,
forbidClientAccountCreation: false,
restrictCreationByEmailDomain: null,
loginExpirationInDays: 90,
passwordResetTokenExpirationInDays: 3,
passwordEnrollTokenExpirationInDays: 30,
passwordSignupFields: _passwordSignupFields.EMAIL_ONLY,
minimumPasswordLength: 7,
path: '/accounts'
};
/***/ }
/******/ ])
});
;

11

package.json
{
"name": "@accounts/common",
"version": "0.0.8-alpha.840bab8d",
"version": "0.0.8-alpha.bba71456",
"description": "Fullstack authentication and accounts-management",
"main": "lib/index.js",
"jsnext:main": "lib-es6/index.js",
"publishConfig": {

@@ -11,3 +12,5 @@ "access": "public"

"start": "webpack -p --config --progress --watch",
"compile": "babel ./src --out-dir ./lib",
"compile": "npm run compile:es6 && npm run compile:umd",
"compile:es6": "babel ./src --out-dir ./lib-es6",
"compile:umd": "webpack",
"postcompile": "npm run flow:prepublish",

@@ -20,3 +23,3 @@ "prepublish": "npm run compile",

"flow:gen": "flow gen-flow-files ./src/index.js > ./lib/index.js.flow",
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib/g\" | sed \"s/js/js\\.flow/g\"`; done",
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib-es6/g\" | sed \"s/js/js\\.flow/g\"`; done",
"coverage": "npm run testonly -- --coverage",

@@ -58,4 +61,6 @@ "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"

"babel-plugin-transform-regenerator": "^6.16.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-es2015-node4": "^2.1.0",
"babel-preset-stage-0": "^6.22.0",
"coveralls": "^2.11.14",

@@ -62,0 +67,0 @@ "flow-bin": "^0.39.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc