Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createHash() {
var algorithm = config.get('hashAlgorithm');
var passwordValidator = function (value) {
if (!value) {
throw new Error('Password cannot be empty!');
}
return value;
};
console.log('Hashing algorithm: ', algorithm);
promptly.password('Password: ', { validator: passwordValidator }, function (err, password) {
console.log('Password hash: ', crypto.createHash(algorithm).update(password).digest("hex"));
});
}
const createUser = (config: FactoryConfig) => async ({
defaultEmail,
defaultPassword,
rolesIds,
userType,
}: Options) => {
console.log(`--------------------------------------------------------`);
console.log(`Creating ${userType}...`);
const email = await promptly.prompt(
`Choose email [default: ${defaultEmail}]: `,
{ default: defaultEmail }
);
const password = await promptly.password(
`Choose password [default: ${defaultPassword}]: `,
{ default: defaultPassword }
);
const { service } = config;
console.log('Validating input...');
validateData(rules)({ email, password });
console.log('Input validated successfuly!');
console.log(`Creating ${userType}...`);
const userId = uuid();
const { item: user } = await service.users.createItem({
id: userId,
function input(info, cb, password) {
var pcb = function(err, anwser) {
cb(anwser);
};
if (password) {
promptly.password(info, pcb);
} else {
promptly.prompt(info, pcb);
}
}
/**
smtpPassword: ['smtpUsername', function (done, results) {
Promptly.password('SMTP password:', done);
}],
createConfig: ['smtpPassword', function (done, results) {
export const getPassword = (passwordHint: string, retry?: boolean): Promise =>
promptly.password(retry
? 'Wrong password, please re-enter: '
: `Please enter password (${passwordHint}): `,
{ replace: '*' })
module.exports = async ({}) => {
return await promptly.password(walletPasswordPrompt, {replace: mask});
};
rootPassword: ['rootEmail', (results, done) => {
Promptly.password('Root user password:', done);
}],
setupRootUser: ['rootPassword', (results, done) => {