mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-07 06:25:21 +02:00
rm: remove the generate password file
This commit is contained in:
parent
331d45bf73
commit
4dded6379b
3 changed files with 0 additions and 55 deletions
|
@ -17,8 +17,6 @@
|
|||
"test:js": "cross-env NODE_ENV=testing mocha --recursive ./dist/test --exit",
|
||||
"test": "cross-env NODE_ENV=testing ts-mocha ./src/test/*.ts ./src/test/**/*.ts --exit",
|
||||
"lint": "eslint --fix --ext .ts ./src/backend",
|
||||
"generatePassword:ts": "ts-node ./src/generatePassword.ts",
|
||||
"generatePassword": "node ./dist/generatePassword.js",
|
||||
"editor-upgrade": "yarn add -D @editorjs/{editorjs,header,code,delimiter,list,link,image,table,inline-code,marker,warning,checklist,raw}@latest"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import database from './backend/utils/database';
|
||||
import commander from 'commander';
|
||||
import bcrypt from 'bcrypt';
|
||||
|
||||
const db = database['password'];
|
||||
const program = commander.program;
|
||||
const saltRounds = 12;
|
||||
|
||||
/**
|
||||
* Script for generating password, that will be used to create and edit pages in CodeX.Docs.
|
||||
* Hashes password with bcrypt and inserts it to the database.
|
||||
*
|
||||
* @see {https://github.com/tj/commander.js | CommanderJS}
|
||||
*/
|
||||
program
|
||||
.description('Application for generating password, that will be used to create and edit pages in CodeX.Docs.')
|
||||
.usage('[password]')
|
||||
.arguments('<password>')
|
||||
.action(async function (password) {
|
||||
bcrypt.hash(password, saltRounds, async (error, hash) => {
|
||||
if (error) {
|
||||
return 'Hash generating error';
|
||||
}
|
||||
|
||||
const userDoc = { passHash: hash };
|
||||
|
||||
await db.remove({}, { multi: true });
|
||||
await db.insert(userDoc);
|
||||
|
||||
console.log('Password was successfully generated');
|
||||
});
|
||||
});
|
||||
|
||||
program.on('--help', () => {
|
||||
console.log('');
|
||||
console.log('Example:');
|
||||
console.log('yarn generatePassword qwerty');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (process.argv.length !== 3) {
|
||||
console.error('Invalid command: %s\nSee --help or -h for a list of available commands.', program.args.join(' '));
|
||||
process.exit(1);
|
||||
}
|
|
@ -3847,11 +3847,6 @@ human-signals@^2.1.0:
|
|||
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
|
||||
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==
|
||||
|
||||
husky@^7.0.4:
|
||||
version "7.0.4"
|
||||
resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.4.tgz#242048245dc49c8fb1bf0cc7cfb98dd722531535"
|
||||
integrity sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==
|
||||
|
||||
iconv-lite@0.4.24:
|
||||
version "0.4.24"
|
||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue