Added terms of service checkbox validation

pull/2/head
Sahat Yalkabov 2013-12-12 00:26:57 -05:00
parent b76e67d3a4
commit 11296bccd4
2 changed files with 8 additions and 1 deletions

View File

@ -79,7 +79,14 @@ exports.getSignup = function(req, res) {
*/
exports.postSignup = function(req, res) {
console.log(req.body.tos);
// TODO: add mongoose validation on ToS (virtual?)
// TODO: Mongoose virtual, move logic to model
if (!req.body.tos) {
req.flash('messages', 'You must agree to terms and conditions');
return res.redirect('/signup');
}
if (req.body.password !== req.body.confirmPassword) {
req.flash('messages', 'Passwords do not match');
return res.redirect('/signup');

View File

@ -22,7 +22,7 @@ block content
input.form-control(type='password', name='confirmPassword', id='confirmPassword', placeholder='Confirm Password')
.help-block
label.checkbox
input(type='checkbox')
input(type='checkbox', id='tos', name='tos')
| I agree to 
a(href='#terms-conditions', data-toggle='modal') terms and conditions
.form-group