浏览代码

fix spurious log messages in captcha and mbeans classes

Jason Rivard 6 年之前
父节点
当前提交
db1407912c

+ 1 - 0
server/src/main/java/password/pwm/PwmConstants.java

@@ -217,6 +217,7 @@ public abstract class PwmConstants
             "Your password must be scanned by the TSA to ensure the safety of your fellow travelers.  Please take off your password's shoes to continue.",
             "That password really tied the room together dude.",
             "Bite my shiny metal password!",
+            "ben makes password software go woooo",
 
             //nick helm
             "I needed a password eight characters long so I picked Snow White and the Seven Dwarves.",

+ 12 - 9
server/src/main/java/password/pwm/util/CaptchaUtility.java

@@ -338,16 +338,19 @@ public class CaptchaUtility
         final String configValue = pwmRequest.getConfig().readSettingAsString( PwmSetting.CAPTCHA_SKIP_PARAM );
         if ( !StringUtil.isEmpty( configValue ) )
         {
-            final String skipCaptcha = pwmRequest.readParameterAsString( PwmConstants.PARAM_SKIP_CAPTCHA );
-            if ( StringUtil.nullSafeEquals( configValue, skipCaptcha ) )
+            final String requestValue = pwmRequest.readParameterAsString( PwmConstants.PARAM_SKIP_CAPTCHA );
+            if ( !StringUtil.isEmpty( requestValue ) )
             {
-                LOGGER.trace( pwmRequest, () -> "valid skipCaptcha value in request, skipping captcha check for this session" );
-                pwmRequest.getPwmSession().getSessionStateBean().setCaptchaBypassedViaParameter( true );
-                return true;
-            }
-            else
-            {
-                LOGGER.error( pwmRequest, "skipCaptcha value is in request, however value '" + skipCaptcha + "' does not match configured value" );
+                if ( StringUtil.nullSafeEquals( configValue, requestValue ) )
+                {
+                    LOGGER.trace( pwmRequest, () -> "valid skipCaptcha value in request, skipping captcha check for this session" );
+                    pwmRequest.getPwmSession().getSessionStateBean().setCaptchaBypassedViaParameter( true );
+                    return true;
+                }
+                else
+                {
+                    LOGGER.error( pwmRequest, "skipCaptcha value is in request, however value '" + requestValue + "' does not match configured value" );
+                }
             }
         }
 

+ 2 - 2
server/src/main/java/password/pwm/util/MBeanUtility.java

@@ -64,7 +64,7 @@ public class MBeanUtility
         }
         catch ( Exception e )
         {
-            LOGGER.error( "error registering mbean: " + e.getMessage() );
+            LOGGER.debug( () -> "error registering mbean: " + e.getMessage() );
         }
     }
 
@@ -77,7 +77,7 @@ public class MBeanUtility
         }
         catch ( Exception e )
         {
-            LOGGER.error( "error unregistering mbean: " + e.getMessage() );
+            LOGGER.debug( () -> "error unregistering mbean: " + e.getMessage() );
         }
     }