Guest User

Untitled

a guest
Jul 6th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. /*
  2. * Sync all tables to database
  3. */
  4. db.sequelize.sync({force:true}).then(function(){
  5. console.log('DB Connection - OK');
  6. let crypto = require('crypto');
  7. //Lib for crypting strings
  8. let crypto = require('crypto');
  9.  
  10. //Creating my cipher, by using the key REPLACE_YOUR_KEY_HERE
  11. let cipher = crypto.createCipher('aes192','REPLACE_YOUR_KEY_HERE');
  12.  
  13. //Crypting ADM string
  14. let crypted = cipher.update('ADM','utf8','hex');
  15. crypted += cipher.final('hex');
  16. if(crypted){
  17. //Creating ADM user
  18. db.User.create({username: 'ADM', password: crypted}).then(function() {
  19. console.log('ADM user inserted');
  20. }, function (error) {
  21. console.log(error);res.sendStatus(500);
  22. });
  23. }else{
  24. console.log('Something went wrong with crypting the password :(');
  25. }
  26. });
Add Comment
Please, Sign In to add comment