fix: Add error handling and refactoring of Observable methods
This commit is contained in:
committed by
Berkeley Martinez
parent
a426ff7ef9
commit
3f332fc1f0
@@ -290,15 +290,11 @@ module.exports = function(app) {
|
||||
|
||||
const userId = authToken.userId;
|
||||
return User.findById(userId, (err, user) => {
|
||||
if (err) {
|
||||
if (err || !user || user.email !== authEmailId) {
|
||||
debug(err);
|
||||
req.flash('info', { msg: defaultErrorMsg });
|
||||
return res.redirect('/email-signin');
|
||||
}
|
||||
if (user.email !== authEmailId) {
|
||||
req.flash('info', { msg: defaultErrorMsg });
|
||||
return res.redirect('/email-signin');
|
||||
}
|
||||
return authToken.validate((err, isValid) => {
|
||||
if (err) { throw err; }
|
||||
if (!isValid) {
|
||||
|
Reference in New Issue
Block a user