Last active
August 29, 2015 14:15
-
-
Save blizzarddreams/12cd7df9778e034f97b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get('/', function(req, res) { | |
| res.sendFile(__dirname + '/views/login.html'); | |
| }); | |
| app.post('/', function(req, res) { | |
| var user = req.body.user; | |
| var pass = req.body.pass; | |
| bcrypt.genSalt(20, function(err, salt) { | |
| bcrypt.hash(pass, salt, function(err, hash) { | |
| var user = new User({ | |
| user: user, | |
| pass: pass, | |
| hash: hash | |
| }).save(function(err, user) { | |
| if (err) console.error(err); | |
| res.redirect('/'); | |
| }); | |
| }); | |
| }); | |
| }); | |
| app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment