Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Sync all tables to database
- */
- db.sequelize.sync({force:true}).then(function(){
- console.log('DB Connection - OK');
- let crypto = require('crypto');
- //Lib for crypting strings
- let crypto = require('crypto');
- //Creating my cipher, by using the key REPLACE_YOUR_KEY_HERE
- let cipher = crypto.createCipher('aes192','REPLACE_YOUR_KEY_HERE');
- //Crypting ADM string
- let crypted = cipher.update('ADM','utf8','hex');
- crypted += cipher.final('hex');
- if(crypted){
- //Creating ADM user
- db.User.create({username: 'ADM', password: crypted}).then(function() {
- console.log('ADM user inserted');
- }, function (error) {
- console.log(error);res.sendStatus(500);
- });
- }else{
- console.log('Something went wrong with crypting the password :(');
- }
- });
Add Comment
Please, Sign In to add comment