replace underscore with our own

we only need like 5 simple functions
This commit is contained in:
Girish Ramakrishnan
2025-02-13 14:03:25 +01:00
parent c46c41db5a
commit dd5e4adc73
25 changed files with 111 additions and 65 deletions

View File

@@ -103,7 +103,7 @@ const appPasswords = require('./apppasswords.js'),
superagent = require('superagent'),
util = require('util'),
validator = require('validator'),
_ = require('underscore');
_ = require('./underscore.js');
const CRYPTO_SALT_SIZE = 64; // 512-bit salt
const CRYPTO_ITERATIONS = 10000; // iterations
@@ -191,7 +191,9 @@ function validatePassword(password) {
// remove all fields that should never be sent out via REST API
function removePrivateFields(user) {
const result = _.pick(user, 'id', 'username', 'email', 'fallbackEmail', 'displayName', 'groupIds', 'active', 'source', 'role', 'createdAt', 'twoFactorAuthenticationEnabled', 'notificationConfig');
const result = _.pick(user, [
'id', 'username', 'email', 'fallbackEmail', 'displayName', 'groupIds', 'active', 'source', 'role', 'createdAt',
'twoFactorAuthenticationEnabled', 'notificationConfig']);
// invite status indicator
result.inviteAccepted = !user.inviteToken;
@@ -596,8 +598,6 @@ async function update(user, data, auditSource) {
if (constants.DEMO && user.username === constants.DEMO_USERNAME) throw new BoxError(BoxError.BAD_STATE, 'Not allowed in demo mode');
if (_.isEmpty(data)) return;
if (data.username) {
// regardless of "account setup", username cannot be changed because admin could have logged in with temp password and apps
// already know about it