Wiping more information

Ensuring documents and collections created by user still load
This commit is contained in:
Tom Moor
2018-07-10 19:47:15 -07:00
parent 068f199bb0
commit 22d02da2f9
2 changed files with 15 additions and 9 deletions

View File

@ -25,7 +25,7 @@ const User = sequelize.define(
slackData: DataTypes.JSONB,
jwtSecret: encryptedFields.vault('jwtSecret'),
lastActiveAt: DataTypes.DATE,
lastActiveIp: DataTypes.STRING,
lastActiveIp: { type: DataTypes.STRING, allowNull: true },
lastSignedInAt: DataTypes.DATE,
lastSignedInIp: DataTypes.STRING,
suspendedAt: DataTypes.DATE,
@ -92,12 +92,18 @@ const setRandomJwtSecret = model => {
model.jwtSecret = crypto.randomBytes(64).toString('hex');
};
const removeIdentifyingInfo = model => {
const removeIdentifyingInfo = async model => {
model.email = '';
model.username = '';
model.name = 'Unknown';
model.avatarUrl = '';
model.serviceId = '';
model.username = null;
model.slackData = null;
model.serviceId = null;
model.isAdmin = false;
model.lastActiveIp = null;
// this shouldn't be needed once this issue is resolved:
// https://github.com/sequelize/sequelize/issues/9318
await model.save({ hooks: false });
};
const checkLastAdmin = async model => {