reverted signup route

This commit is contained in:
bill bittner 2018-03-15 17:19:16 -07:00
parent aa5dd711de
commit 9db9471a1e
3 changed files with 10 additions and 27 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -3,35 +3,18 @@ const passport = require('passport');
module.exports = (app) => { module.exports = (app) => {
// route for sign up // route for sign up
app.post('/signup', (req, res, next) => { app.post('/signup', passport.authenticate('local-signup'), (req, res) => {
passport.authenticate('local-signup', (err, user, info) => {
logger.verbose(`successful signup for ${req.user.channelName}`); logger.verbose(`successful signup for ${req.user.channelName}`);
if (err) {
console.log('err >> err:', err);
return res.status(400).json({
success: false,
message: info.message,
});
}
if (!user) {
console.log('!user >> info:', info);
return res.status(400).json({
success: false,
message: info.message,
});
}
res.status(200).json({ res.status(200).json({
success : true, success : true,
channelName : req.user.channelName, channelName : req.user.channelName,
channelClaimId: req.user.channelClaimId, channelClaimId: req.user.channelClaimId,
shortChannelId: req.user.shortChannelId, shortChannelId: req.user.shortChannelId,
}); });
})(req, res, next);
}); });
// route for log in // route for log in
app.post('/login', (req, res, next) => { app.post('/login', (req, res, next) => {
passport.authenticate('local-login', (err, user, info) => { passport.authenticate('local-login', (err, user, info) => {
logger.verbose('login info:', info);
if (err) { if (err) {
return next(err); return next(err);
} }