From 86918fe5eee925a1a1eb0b836e177b247c0700b9 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 21 Nov 2012 06:51:11 +0400 Subject: No bcrypt --- app.coffee | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/app.coffee b/app.coffee index 1dca452b..708d06b4 100644 --- a/app.coffee +++ b/app.coffee @@ -3,7 +3,6 @@ http = require('http') path = require('path') engines = require('consolidate') passport = require('passport') -bcrypt = require('bcrypt') config = require('./config') app = express() @@ -45,14 +44,6 @@ app.get('/', (req, res) -> res.render('index', js: (-> global.js), css: (-> global.css)) ) -app.get('/bcrypt', (req, res) -> - salt = "$2a$10$3R8tUtIoU/fllQD9zEgTZe" - hash = bcrypt.hashSync("chelsea", salt) - res.write(salt + "\n") - res.write(hash) - res.end() -) - app.get('/:user/report', (req, res) -> res.render('report', user: req.params.user, @@ -128,31 +119,6 @@ app.post('/login', (req, res, next) -> )(req, res, next) ) -app.post('/users', (req, res) -> - if req.body.login - if req.body.password - bcrypt.hash(req.body.password, 12, (err, hash) -> - db = require("redis").createClient() - db.hget(req.body.login, 'password', (err, password) -> - bcrypt.compare(req.body.password, password, (err, match) -> - if match - req.body.password = password - db.hmset(req.body.login, req.body, -> - res.redirect(req.body.login) - ) - else - res.redirect(req.body.login) - ) - ) - ) - else - params = [] - for k,v of req.body - params.push(encodeURIComponent(k), '=', encodeURIComponent(v), '&') - params.pop() if (params.length) - res.redirect('calculator?' + params.join('')) -) - app.post('/:user/transactions', (req, res) -> user = req.params.user db = require("redis").createClient() -- cgit v1.2.3