Просмотр исходного кода

ensure to set flash message when some DB error occur

Yuki Takei 8 лет назад
Родитель
Сommit
38a9bfccc9
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      lib/routes/login-passport.js

+ 6 - 4
lib/routes/login-passport.js

@@ -58,8 +58,9 @@ module.exports = function(crowi, app) {
       debug('info', info);
 
       if (err) {  // DB Error
-        console.log('An Error occured: ', err);
-        return next(err);
+        console.log('LDAP Server Error: ', err);
+        req.flash('warningMessage', 'LDAP Server Error occured.');
+        return next(); // pass and the flash message is displayed when all of authentications are failed.
       }
       if (!user) { return next(); }
       req.logIn(user, (err) => {
@@ -91,8 +92,9 @@ module.exports = function(crowi, app) {
       debug('info', info);
 
       if (err) {  // DB Error
-        console.log('An Error occured: ', err);
-        return next(err);
+        console.log('Database Server Error: ', err);
+        req.flash('warningMessage', 'Database Server Error occured.');
+        return next(); // pass and the flash message is displayed when all of authentications are failed.
       }
       if (!user) { return next(); }
       req.logIn(user, (err) => {