| "jshint": "^2.8.0", | "jshint": "^2.8.0", | ||||
| "mlogger": "^1.1.0", | "mlogger": "^1.1.0", | ||||
| "pg": "^4.4.0", | "pg": "^4.4.0", | ||||
| "scrypt": "^4.0.7", | |||||
| "scrypt": "^5.1.0", | |||||
| "uglify-js": "^2.4.24", | "uglify-js": "^2.4.24", | ||||
| "uglifycss": "0.0.15", | "uglifycss": "0.0.15", | ||||
| "wrench": "^1.5.8" | "wrench": "^1.5.8" |
| if (!/^[a-zA-Z0-9_\-]+$/.test(data.username)) | if (!/^[a-zA-Z0-9_\-]+$/.test(data.username)) | ||||
| return ctx.fail("Username contains illegal characters."); | return ctx.fail("Username contains illegal characters."); | ||||
| var params = scrypt.params(ctx.conf.scrypt.maxtime); | |||||
| scrypt.hash(new Buffer(data.password), params, function(err, hash) { | |||||
| var params = scrypt.paramsSync(ctx.conf.scrypt.maxtime); | |||||
| scrypt.kdf(new Buffer(data.password), params, function(err, hash) { | |||||
| if (err) | if (err) | ||||
| return ctx.fail(err); | return ctx.fail(err); | ||||
| ctx.login(user.username, user.id); | ctx.login(user.username, user.id); | ||||
| scrypt.verify( | |||||
| scrypt.verifyKdf( | |||||
| new Buffer(user.pass_hash, "hex"), | new Buffer(user.pass_hash, "hex"), | ||||
| new Buffer(ctx.postData.data.password), | new Buffer(ctx.postData.data.password), | ||||
| function(err, success) { | function(err, success) { |