mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
buffer deprecation
This commit is contained in:
parent
5e921c474b
commit
8bef798eec
@ -2,6 +2,7 @@ const inquirer = require('inquirer');
|
||||
const colors = require('colors');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Buffer = require('buffer').Buffer;
|
||||
|
||||
// TODO: Get this from login module
|
||||
const hashConfig = {
|
||||
@ -355,7 +356,7 @@ exports.addUser = function(current, callback) {
|
||||
console.log(`Failed to hash password`);
|
||||
return;
|
||||
}
|
||||
cb(salt, new Buffer(hash).toString('hex'));
|
||||
cb(salt, Buffer.from(hash).toString('hex'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
const jwt = require('jsonwebtoken');
|
||||
const crypto = require('crypto');
|
||||
const winston = require('winston');
|
||||
const Buffer = require('buffer').Buffer;
|
||||
|
||||
exports.setup = function (mstream, program) {
|
||||
// Crypto Config
|
||||
@ -43,7 +44,7 @@ exports.setup = function (mstream, program) {
|
||||
|
||||
// If the user already has a salt, it means the password is hashed and can be used as is
|
||||
if (program.users[username].salt) {
|
||||
program.users[username].salt = new Buffer(program.users[username].salt);
|
||||
program.users[username].salt = Buffer.from(program.users[username].salt);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -62,7 +63,7 @@ exports.setup = function (mstream, program) {
|
||||
winston.error(`Failed to hash password for user ${username}: ${err}`);
|
||||
return;
|
||||
}
|
||||
program.users[username]['password'] = new Buffer(hash).toString('hex');
|
||||
program.users[username]['password'] = Buffer.from(hash).toString('hex');
|
||||
program.users[username]['salt'] = salt;
|
||||
});
|
||||
});
|
||||
@ -99,7 +100,7 @@ exports.setup = function (mstream, program) {
|
||||
return res.redirect('/login-failed');
|
||||
}
|
||||
|
||||
if (new Buffer(verifyHash).toString('hex') !== program.users[username]['password']) {
|
||||
if (Buffer.from(verifyHash).toString('hex') !== program.users[username]['password']) {
|
||||
return res.redirect('/login-failed');
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user