reverted signup route
This commit is contained in:
parent
aa5dd711de
commit
9db9471a1e
3 changed files with 10 additions and 27 deletions
2
index.js
2
index.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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}`);
|
res.status(200).json({
|
||||||
if (err) {
|
success : true,
|
||||||
console.log('err >> err:', err);
|
channelName : req.user.channelName,
|
||||||
return res.status(400).json({
|
channelClaimId: req.user.channelClaimId,
|
||||||
success: false,
|
shortChannelId: req.user.shortChannelId,
|
||||||
message: info.message,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!user) {
|
|
||||||
console.log('!user >> info:', info);
|
|
||||||
return res.status(400).json({
|
|
||||||
success: false,
|
|
||||||
message: info.message,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
res.status(200).json({
|
|
||||||
success : true,
|
|
||||||
channelName : req.user.channelName,
|
|
||||||
channelClaimId: req.user.channelClaimId,
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue