Skip to content

Commit

Permalink
Fixed the registration
Browse files Browse the repository at this point in the history
  • Loading branch information
William Moody committed Mar 21, 2021
1 parent a53f33c commit 718ae2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Empty file modified .exploit/dumpPasspord.py 100644 → 100755
Empty file.
11 changes: 8 additions & 3 deletions app.js
Expand Up @@ -123,11 +123,16 @@ app.post('/register', function(req, res) {
throw err;
}
if (result == null) {
// TODO: Create new user, and redirect to index
var sha256_password = crypto.createHash('sha256').update(password).digest('hex');
dbo.collection("users").insertOne({
username:username,
password:sha256_password
},function() {
res.redirect('/');
});
} else {
// TODO: Give the user a proper error message
res.render('pages/register', {session: req.session, error:"User already exists"});
}
res.render('pages/register', {session: req.session, error:"Registration failed"});
});
});
}
Expand Down

0 comments on commit 718ae2e

Please sign in to comment.