Remove dead/commented-out code

This commit is contained in:
Calvin Montgomery 2017-04-29 17:08:43 -07:00
parent 089ac75e9a
commit a0af0ccab5
2 changed files with 1 additions and 109 deletions

View file

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.35.4",
"version": "3.35.5",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View file

@ -255,114 +255,6 @@ module.exports.deletePasswordReset = function (hash) {
module.exports.query("DELETE FROM `password_reset` WHERE hash=?", [hash]);
};
/*
module.exports.genPasswordReset = function (ip, name, email, callback) {
if(typeof callback !== "function")
callback = blackHole;
var query = "SELECT email FROM registrations WHERE uname=?";
module.exports.query(query, [name], function (err, res) {
if(err) {
callback(err, null);
return;
}
if(res.length == 0) {
callback("Provided username does not exist", null);
return;
}
if(res[0].email != email) {
callback("Provided email does not match user's email", null);
return;
}
var hash = hashlib.sha256($util.randomSalt(32) + name);
var expire = Date.now() + 24*60*60*1000;
query = "INSERT INTO password_reset " +
"(ip, name, hash, email, expire) VALUES (?, ?, ?, ?, ?) " +
"ON DUPLICATE KEY UPDATE hash=?, expire=?";
module.exports.query(query, [ip, name, hash, email, expire, hash, expire],
function (err, res) {
if(err) {
callback(err, null);
return;
}
callback(null, hash);
});
});
};
module.exports.recoverUserPassword = function (hash, callback) {
if(typeof callback !== "function")
callback = blackHole;
var query = "SELECT * FROM password_reset WHERE hash=?";
module.exports.query(query, [hash], function (err, res) {
if(err) {
callback(err, null);
return;
}
if(res.length == 0) {
callback("Invalid password reset link", null);
return;
}
if(Date.now() > res[0].expire) {
module.exports.query("DELETE FROM password_reset WHERE hash=?", [hash]);
callback("Link expired. Password resets are valid for 24hr",
null);
return;
}
var name = res[0].name;
resetUserPassword(res[0].name, function (err, pw) {
if(err) {
callback(err, null);
return;
}
module.exports.query("DELETE FROM password_reset WHERE hash=?", [hash]);
callback(null, {
name: name,
pw: pw
});
});
});
};
module.exports.resetUserPassword = function (name, callback) {
if(typeof callback !== "function")
callback = blackHole;
var pwChars = "abcdefghijkmnopqrstuvwxyz023456789";
var pw = "";
for(var i = 0; i < 10; i++)
pw += pwChars[parseInt(Math.random() * 33)];
bcrypt.hash(pw, 10, function (err, data) {
if(err) {
LOGGER.error("bcrypt error: " + err);
callback("Password reset failure", null);
return;
}
var query = "UPDATE registrations SET pw=? WHERE uname=?";
module.exports.query(query, [data, name], function (err, res) {
if(err) {
callback(err, null);
return;
}
callback(null, pw);
});
});
};
*/
/* user playlists */
/**