settings: async'ify
* directory config * unstable app config
This commit is contained in:
@@ -92,7 +92,6 @@ const CRYPTO_DIGEST = 'sha1'; // used to be the default in node 4.1.1 cannot cha
|
||||
|
||||
const pbkdf2Async = util.promisify(crypto.pbkdf2);
|
||||
const randomBytesAsync = util.promisify(crypto.randomBytes);
|
||||
const getDirectoryConfigAsync = util.promisify(settings.getDirectoryConfig);
|
||||
|
||||
function postProcess(result) {
|
||||
assert.strictEqual(typeof result, 'object');
|
||||
@@ -660,7 +659,7 @@ async function createInvite(user, auditSource) {
|
||||
|
||||
const resetToken = hat(256), resetTokenCreationTime = new Date();
|
||||
|
||||
const directoryConfig = await getDirectoryConfigAsync();
|
||||
const directoryConfig = await settings.getDirectoryConfig();
|
||||
|
||||
await update(user, { resetToken, resetTokenCreationTime }, auditSource);
|
||||
|
||||
@@ -676,7 +675,7 @@ async function sendInvite(user, options) {
|
||||
if (user.source) throw new BoxError(BoxError.CONFLICT, 'User is from an external directory');
|
||||
if (!user.resetToken) throw new BoxError(BoxError.CONFLICT, 'Must generate resetToken to send invitation');
|
||||
|
||||
const directoryConfig = await getDirectoryConfigAsync();
|
||||
const directoryConfig = await settings.getDirectoryConfig();
|
||||
|
||||
mailer.sendInvite(user, options.invitor || null, inviteLink(user, directoryConfig));
|
||||
}
|
||||
@@ -686,7 +685,7 @@ async function setupAccount(user, data, auditSource) {
|
||||
assert.strictEqual(typeof data, 'object');
|
||||
assert(auditSource && typeof auditSource === 'object');
|
||||
|
||||
const directoryConfig = await getDirectoryConfigAsync();
|
||||
const directoryConfig = await settings.getDirectoryConfig();
|
||||
if (directoryConfig.lockUserProfiles) return;
|
||||
|
||||
await update(user, _.pick(data, 'username', 'displayName'), auditSource);
|
||||
|
||||
Reference in New Issue
Block a user