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

Merge branch 'master' into feat/109648-use-configured-xss-custom-whitelist

Shun Miyazawa 3 лет назад
Родитель
Сommit
19d25c997e

+ 2 - 1
packages/app/src/server/routes/apiv3/index.js

@@ -48,7 +48,8 @@ module.exports = (crowi, app) => {
   const loginPassport = require('../login-passport')(crowi, app);
   const loginPassport = require('../login-passport')(crowi, app);
 
 
   routerForAuth.post('/login', applicationInstalled, loginFormValidator.loginRules(), loginFormValidator.loginValidation,
   routerForAuth.post('/login', applicationInstalled, loginFormValidator.loginRules(), loginFormValidator.loginValidation,
-    addActivity, loginPassport.loginWithLocal, loginPassport.loginWithLdap, loginPassport.cannotLoginErrorHadnler, loginPassport.loginFailure);
+    addActivity, loginPassport.isEnableLoginWithLocalOrLdap, loginPassport.loginWithLocal, loginPassport.loginWithLdap,
+    loginPassport.cannotLoginErrorHadnler, loginPassport.loginFailure);
 
 
   routerForAuth.use('/invited', require('./invited')(crowi));
   routerForAuth.use('/invited', require('./invited')(crowi));
   routerForAuth.use('/logout', require('./logout')(crowi));
   routerForAuth.use('/logout', require('./logout')(crowi));

+ 12 - 1
packages/app/src/server/routes/login-passport.js

@@ -133,6 +133,16 @@ module.exports = function(crowi, app) {
     return res.apiv3({ redirectTo, userStatus: req.user.status });
     return res.apiv3({ redirectTo, userStatus: req.user.status });
   };
   };
 
 
+  const isEnableLoginWithLocalOrLdap = (req, res, next) => {
+    if (!passportService.isLocalStrategySetup && !passportService.isLdapStrategySetup) {
+      logger.error('LocalStrategy and LdapStrategy has not been set up');
+      const error = new ErrorV3('message.strategy_has_not_been_set_up', '', undefined, { strategy: 'LocalStrategy and LdapStrategy' });
+      return next(error);
+    }
+
+    return next();
+  };
+
   const cannotLoginErrorHadnler = (req, res, next) => {
   const cannotLoginErrorHadnler = (req, res, next) => {
     // this is called when all login method is somehow failed without invoking 'return next(<any Error>)'
     // this is called when all login method is somehow failed without invoking 'return next(<any Error>)'
     const err = new ErrorV3('message.sign_in_failure');
     const err = new ErrorV3('message.sign_in_failure');
@@ -328,7 +338,7 @@ module.exports = function(crowi, app) {
   const loginWithLocal = (req, res, next) => {
   const loginWithLocal = (req, res, next) => {
     if (!passportService.isLocalStrategySetup) {
     if (!passportService.isLocalStrategySetup) {
       debug('LocalStrategy has not been set up');
       debug('LocalStrategy has not been set up');
-      return res.apiv3Err(new ErrorV3('message.strategy_has_not_been_set_up', '', undefined, { strategy: 'LocalStrategy' }), 405);
+      return next();
     }
     }
 
 
     if (!req.form.isValid) {
     if (!req.form.isValid) {
@@ -585,6 +595,7 @@ module.exports = function(crowi, app) {
 
 
   return {
   return {
     cannotLoginErrorHadnler,
     cannotLoginErrorHadnler,
+    isEnableLoginWithLocalOrLdap,
     loginFailure,
     loginFailure,
     loginFailureForExternalAccount,
     loginFailureForExternalAccount,
     loginWithLdap,
     loginWithLdap,

+ 1 - 1
packages/app/src/styles/theme/_apply-colors-dark.scss

@@ -13,7 +13,6 @@
   $color-list-active: var(--color-list-active,var(--color-reversal));
   $color-list-active: var(--color-list-active,var(--color-reversal));
   $bgcolor-list-hover: var(--bgcolor-list-hover,var(--bgcolor-global));
   $bgcolor-list-hover: var(--bgcolor-list-hover,var(--bgcolor-global));
   $bgcolor-list-active: var(--bgcolor-list-active,var(--primary));
   $bgcolor-list-active: var(--bgcolor-list-active,var(--primary));
-  $bgcolor-subnav: var(--bgcolor-subnav);
   $color-table: var(--color-table,white);
   $color-table: var(--color-table,white);
   $bgcolor-table: var(--bgcolor-table,#343a40);
   $bgcolor-table: var(--bgcolor-table,#343a40);
   $border-color-table: var(--border-color-table,hsl.lighten(var(--bgcolor-table),7.5%),lighten(#343a40, 7.5%));
   $border-color-table: var(--border-color-table,hsl.lighten(var(--bgcolor-table),7.5%),lighten(#343a40, 7.5%));
@@ -574,5 +573,6 @@
   * skeleton
   * skeleton
   */
   */
   .grw-skeleton {
   .grw-skeleton {
+    background-color: hsl.lighten(var(--bgcolor-subnav),10%);
   }
   }
 }
 }

+ 1 - 1
packages/app/src/styles/theme/_apply-colors-light.scss

@@ -459,6 +459,6 @@
   * skeleton
   * skeleton
   */
   */
   .grw-skeleton {
   .grw-skeleton {
-    background-color: hsl.lighten(var(--bgcolor-navbar),10%);
+    background-color: hsl.darken(var(--bgcolor-subnav),10%);
   }
   }
 }
 }

+ 1 - 1
packages/core/src/models/vo/error-apiv3.ts

@@ -4,7 +4,7 @@ export class ErrorV3 extends Error {
 
 
   args?: any;
   args?: any;
 
 
-  constructor(message = '', code = '', stack = undefined, args = undefined) {
+  constructor(message = '', code = '', stack = undefined, args: any = undefined) {
     super(); // do not provide message to the super constructor
     super(); // do not provide message to the super constructor
     this.message = message;
     this.message = message;
     this.code = code;
     this.code = code;