This file contains 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
exports.registerUser = async function registerUser(req, res) { | |
let emailStatus = await checkUserEmail(req.body.email); | |
if (emailStatus) { | |
console.log('This is a valid email!'); | |
} else { | |
console.log('This is not a valid email!'); | |
} |
This file contains 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
exports.registerUser = async function registerUser(user) { | |
let emailStatus = await checkUserEmail(user); | |
if (emailStatus) { | |
console.log('This is a valid email!'); | |
} else { | |
console.log('This is not a valid email!'); | |
} |
This file contains 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
//client-side | |
$(function() { | |
var $modal = $('.modal-wrapper'); | |
var $bodypart = $('#bodyselect').val(); | |
var $bodyform = $('.bodyform'); | |
var $measurement = $('.measure').val(); | |
$bodyform.submit(function(event) { |
This file contains 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
//client-side | |
$(function() { | |
var $chest = $('.chest'); | |
var $chestForm = $('.chest-form'); | |
$chest.blur(function() { | |
$chestForm.submit(); | |
}); | |
$chestForm.submit(function(event) { | |
event.preventDefault(); |
This file contains 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
router.post('/', function (req, res) { | |
function repeatedUser() { | |
req.body.uniqueUser = false; | |
req.check('uniqueUser', 'That username already exists').equals(false); | |
var errors = req.validationErrors(); | |
req.session.errors = errors; | |
req.session.success = false; | |
res.redirect('/register'); | |
} |
This file contains 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
function doesUserExist() { | |
var rowCount; | |
pg.connect(conString, function (err, client, done) { | |
client.query('SELECT user_id FROM clients.users where user_id=$1', [req.body.user], function(err, result) { | |
if (err) { | |
console.log('error fetching client from pool', err); | |
} | |
else if (result.rowCount === 1) { | |
return rowCount = 1; | |
} |