Created
February 21, 2012 18:20
-
-
Save deedubs/1877950 to your computer and use it in GitHub Desktop.
Post Ban
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.post('/user/ban/:userId', function(req, res){ | |
| req.user.bannedReason = req.body.bannedReason; | |
| req.user.banned = true; | |
| console.log(req.user.id) | |
| req.user.save(function(err) { | |
| if (err) { | |
| req.flash('info','User banned:' + req.body.bannedReason); | |
| } else { | |
| req.flash('info','User cannot be banned'); | |
| } | |
| res.redirect('back'); | |
| }); | |
| }); |
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.post('/user/ban/:userId', function(req, res){ | |
| var user = req.user; | |
| user.bannedReason = req.body.bannedReason; | |
| user.banned = true; | |
| user.save(function(err) { | |
| if (!err) { | |
| req.flash('info','User banned:' + req.body.bannedReason); | |
| } else { | |
| req.flash('error','User cannot be banned'); | |
| } | |
| res.redirect('back'); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment