Skip to content

Instantly share code, notes, and snippets.

@blizzarddreams
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save blizzarddreams/12cd7df9778e034f97b2 to your computer and use it in GitHub Desktop.

Select an option

Save blizzarddreams/12cd7df9778e034f97b2 to your computer and use it in GitHub Desktop.
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