Token Cache bug fix and Rate Limiting

This commit is contained in:
Amish Shah
2015-12-16 18:32:01 +00:00
parent 4d47a05a81
commit da990f544a
4 changed files with 143 additions and 112 deletions

View File

@@ -43,7 +43,11 @@ var TokenCacher = (function (_EventEmitter) {
this.data = {};
}
TokenCacher.prototype.setToken = function setToken(email, password, token) {
TokenCacher.prototype.setToken = function setToken() {
var email = arguments.length <= 0 || arguments[0] === undefined ? "" : arguments[0];
var password = arguments.length <= 1 || arguments[1] === undefined ? "" : arguments[1];
var token = arguments.length <= 2 || arguments[2] === undefined ? "" : arguments[2];
email = secureEmail(email, password);
var cipher = _crypto2["default"].createCipher(algo, password);
var crypted = cipher.update("valid" + token, "utf8", "hex");
@@ -56,7 +60,9 @@ var TokenCacher = (function (_EventEmitter) {
_fsExtra2["default"].writeJson(this.savePath, this.data);
};
TokenCacher.prototype.getToken = function getToken(email, password) {
TokenCacher.prototype.getToken = function getToken() {
var email = arguments.length <= 0 || arguments[0] === undefined ? "" : arguments[0];
var password = arguments.length <= 1 || arguments[1] === undefined ? "" : arguments[1];
email = secureEmail(email, password);