diff --git a/routes/auth.js b/routes/auth.js index adc98b1..308eb71 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -64,36 +64,4 @@ router.post('/logout', function(req, res, next) { }); }); -router.get('/signup', function(req, res, next) { - res.render('signup'); -}); - -router.post('/signup', function(req, res, next) { - var salt = crypto.randomBytes(16); - crypto.pbkdf2(req.body.password, salt, 310000, 32, 'sha256', function(err, hashedPassword) { - if (err) { - return next(err); - } - db.run('INSERT INTO users (username, hashed_password, salt) VALUES (?, ?, ?)', [ - req.body.username, - hashedPassword, - salt - ], function(err) { - if (err) { - return next(err); - } - var user = { - id: this.lastID, - username: req.body.username - }; - req.login(user, function(err) { - if (err) { - return next(err); - } - res.redirect('/'); - }); - }); - }); -}); - module.exports = router; diff --git a/routes/index.js b/routes/index.js index f14b068..470bef0 100644 --- a/routes/index.js +++ b/routes/index.js @@ -4,10 +4,6 @@ let multer = require('multer'); let db = require('../db'); let fs = require('fs'); -function extension(string) { - return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2); -} - function extension(str){ let file = str.split('/').pop(); return [file.substr(0,file.lastIndexOf('.')),file.substr(file.lastIndexOf('.'),file.length)] diff --git a/views/index.ejs b/views/index.ejs index e0746f5..90ec324 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -32,7 +32,7 @@ function extension(string) {
Upload a file or drag n' drop into the dashed region
- +Click the file to copy the url