Przeglądaj źródła

show flash message when GoogleStrategy/GitHubStrategy is not set up

Yuki Takei 7 lat temu
rodzic
commit
514a85ab87
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      lib/routes/login-passport.js

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

@@ -208,7 +208,8 @@ module.exports = function(crowi, app) {
   const loginWithGoogle = function(req, res, next) {
     if (!passportService.isGoogleStrategySetup) {
       debug('GoogleStrategy has not been set up');
-      return next('GoogleStrategy has not been set up');
+      req.flash('warningMessage', 'GoogleStrategy has not been set up');
+      return next();
     }
 
     passport.authenticate('google', {
@@ -242,7 +243,8 @@ module.exports = function(crowi, app) {
   const loginWithGitHub = function(req, res, next) {
     if (!passportService.isGitHubStrategySetup) {
       debug('GitHubStrategy has not been set up');
-      return next('GitHubStrategy has not been set up');
+      req.flash('warningMessage', 'GitHubStrategy has not been set up');
+      return next();
     }
 
     passport.authenticate('github')(req, res);