add custom authentication checks

This commit is contained in:
Dzmitry_Tamashevich@epam.com
2020-11-04 23:01:08 +03:00
committed by Daniel Hutzel
parent 3cf02cb567
commit 70b0c85346
14 changed files with 172 additions and 112 deletions

View File

@@ -1,4 +1,7 @@
const { resolve } = require("@sap/cds");
const cds = require("@sap/cds");
const bcrypt = require("bcrypt");
const saltRounds = 10;
const FIRST_INDEX = 0;
const ZERO_VALUE = 0;
@@ -74,6 +77,16 @@ async function importData(targetDb) {
return;
}
const hashedPassword = await new Promise((resolve, reject) =>
bcrypt.hash("some", saltRounds, (error, hash) => {
if (error) {
reject(error);
}
resolve(hash);
})
);
console.log("hashedPassword", hashedPassword);
for (index in targetCSNEntities) {
const targetEntityName = targetCSNEntitiesNames[index];
console.log(`[LOG]: Processing ${targetEntityName}`);
@@ -110,7 +123,7 @@ async function importData(targetDb) {
columns.push("password");
srcResultRows = srcResultRows.map((row) => ({
...row,
password: "some",
password: hashedPassword,
}));
}