jrivard 10 gadi atpakaļ
vecāks
revīzija
861fadf5ff

+ 6 - 5
pwm/servlet/src/password/pwm/PwmApplication.java

@@ -257,23 +257,24 @@ public class PwmApplication {
         for (final Class<? extends PwmService> serviceClass : PWM_SERVICE_CLASSES) {
             final Date startTime = new Date();
             final PwmService newServiceInstance;
+            final String serviceName = serviceClass.getName();
             try {
                 final Object newInstance = serviceClass.newInstance();
                 newServiceInstance = (PwmService)newInstance;
             } catch (Exception e) {
-                final String errorMsg = "unexpected error instantiating service class '" + serviceClass.getName() + "', error: " + e.toString();
+                final String errorMsg = "unexpected error instantiating service class '" + serviceName + "', error: " + e.toString();
                 LOGGER.fatal(errorMsg,e);
                 throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_STARTUP_ERROR,errorMsg));
             }
 
             try {
-                LOGGER.debug("initializing service " + serviceClass.getName());
+                LOGGER.debug("initializing service " + serviceName);
                 newServiceInstance.init(this);
-                LOGGER.debug("completed initialization of service " + serviceClass.getName() + " in " + TimeDuration.fromCurrent(startTime).asCompactString() + ", status=" + newServiceInstance.status());
+                LOGGER.debug("completed initialization of service " + serviceName + " in " + TimeDuration.fromCurrent(startTime).asCompactString() + ", status=" + newServiceInstance.status());
             } catch (PwmException e) {
-                LOGGER.warn("error instantiating service class '" + serviceClass.getName() + "', service will remain unavailable, error: " + e.getMessage());
+                LOGGER.warn("error instantiating service class '" + serviceName + "', service will remain unavailable, error: " + e.getMessage());
             } catch (Exception e) {
-                String errorMsg = "unexpected error instantiating service class '" + serviceClass.getName() + "', cannot load, error: " + e.getMessage();
+                String errorMsg = "unexpected error instantiating service class '" + serviceName + "', cannot load, error: " + e.getMessage();
                 if (e.getCause() != null) {
                     errorMsg += ", cause: " + e.getCause();
                 }

+ 7 - 3
pwm/servlet/src/password/pwm/health/HealthMonitor.java

@@ -153,9 +153,13 @@ public class HealthMonitor implements PwmService {
             }
         }
         for (final PwmService service : pwmApplication.getPwmServices()) {
-            final List<HealthRecord> loopResults = service.healthCheck();
-            if (loopResults != null) {
-                newResults.addAll(loopResults);
+            try {
+                final List<HealthRecord> loopResults = service.healthCheck();
+                if (loopResults != null) {
+                    newResults.addAll(loopResults);
+                }
+            } catch (Exception e) {
+                LOGGER.warn("unexpected error during healthCheck: " + e.getMessage(), e);
             }
         }
         final Set<HealthRecord> sortedRecordList = new TreeSet<>();

+ 10 - 6
pwm/servlet/src/password/pwm/http/servlet/SetupResponsesServlet.java

@@ -49,6 +49,8 @@ import password.pwm.http.bean.SetupResponsesBean;
 import password.pwm.i18n.Message;
 import password.pwm.ldap.UserStatusReader;
 import password.pwm.ldap.auth.AuthenticationType;
+import password.pwm.util.JsonUtil;
+import password.pwm.util.TimeDuration;
 import password.pwm.util.logging.PwmLogger;
 import password.pwm.util.stats.Statistic;
 import password.pwm.ws.server.RestResultBean;
@@ -57,10 +59,7 @@ import javax.servlet.ServletException;
 import javax.servlet.annotation.WebServlet;
 import java.io.IOException;
 import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
 
 /**
  * User interaction servlet for setting up secret question/answer
@@ -72,7 +71,7 @@ import java.util.Map;
         name="SetupResponsesServlet",
         urlPatterns={
                 PwmConstants.URL_PREFIX_PRIVATE + "/setupresponses",
-                PwmConstants.URL_PREFIX_PRIVATE + "/SetupReponses",
+                PwmConstants.URL_PREFIX_PRIVATE + "/SetupResponses",
         }
 )
 public class SetupResponsesServlet extends AbstractPwmServlet {
@@ -291,6 +290,7 @@ public class SetupResponsesServlet extends AbstractPwmServlet {
     )
             throws IOException, ServletException, PwmUnrecoverableException, ChaiUnavailableException
     {
+        final Date startTime = new Date();
         final PwmSession pwmSession = pwmRequest.getPwmSession();
         final PwmApplication pwmApplication = pwmRequest.getPwmApplication();
         final String responseModeParam = pwmRequest.readParameterAsString("responseMode");
@@ -313,7 +313,11 @@ public class SetupResponsesServlet extends AbstractPwmServlet {
         }
 
         final ValidationResponseBean validationResponseBean = new ValidationResponseBean(userMessage,success);
-        pwmRequest.outputJsonResult(new RestResultBean(validationResponseBean));
+        final RestResultBean restResultBean = new RestResultBean(validationResponseBean);
+        LOGGER.trace(pwmRequest,"completed rest validate response in "
+                + TimeDuration.fromCurrent(startTime).asCompactString()
+                + ", result=" + JsonUtil.serialize(restResultBean));
+        pwmRequest.outputJsonResult(restResultBean);
     }
 
     private void handleSetupResponses(

+ 1 - 0
pwm/servlet/src/password/pwm/http/servlet/forgottenpw/ForgottenPasswordServlet.java

@@ -931,6 +931,7 @@ public class ForgottenPasswordServlet extends AbstractPwmServlet {
         } finally {
             pwmSession.clearForgottenPasswordBean();
             pwmSession.unauthenticateUser();
+            pwmSession.getSessionStateBean().setPasswordModified(false);
         }
     }
 

+ 1 - 1
pwm/servlet/src/password/pwm/i18n/Health.properties

@@ -57,7 +57,7 @@ HealthMessage_LDAP_VendorsNotSame=LDAP directories of different vendor types are
 HealthMessage_LDAP_Ad_History_Asn_Missing=%1% is enabled, but the server at %2% does not support this feature.  Check to be sure it is upgraded to Windows Server 2008 R2 SP1 or greater.  Password changes against this server may fail until this is resolved.
 HealthMessage_LDAP_RecentlyUnreachable=LDAP profile %1% was recently unavailable (%2% ago at %3%): %4%
 HealthMessage_Config_ConfigMode=Application is currently in <b>configuration</b> mode.   Anyone accessing this site can modify the configuration without a directory authentication.  When ready, lock the configuration to prevent unauthorized configuration changes.  The configuration can still be edited after closing but will require directory authentication first.
-HealthMessage_CryptoTokenWithNewUserVerification=New User Email Verification is enabled and the token storage method is set to STORE_LDAP, this configuration is not supported.
+HealthMessage_CryptoTokenWithNewUserVerification=%1% is enabled and %2% is set to LDAP, this configuration will not work.
 HealthMessage_TokenServiceError=An error occurred during the TokenService startup: %1%
 HealthMessage_Java_HighThreads=Java thread count is unusually large (%1% threads)
 HealthMessage_Java_SmallHeap=Java maximum memory heap size is set to default of 64MB.  Please increase the memory heap size.

+ 11 - 2
pwm/servlet/src/password/pwm/token/TokenService.java

@@ -286,8 +286,17 @@ public class TokenService implements PwmService {
 
         if (storageMethod == TokenStorageMethod.STORE_LDAP) {
             if (configuration.readSettingAsBoolean(PwmSetting.NEWUSER_ENABLE)) {
-                if (configuration.readSettingAsBoolean(PwmSetting.NEWUSER_EMAIL_VERIFICATION)) {
-                    returnRecords.add(HealthRecord.forMessage(HealthMessage.CryptoTokenWithNewUserVerification));
+                for (final NewUserProfile newUserProfile : configuration.getNewUserProfiles().values()) {
+                    if (newUserProfile.readSettingAsBoolean(PwmSetting.NEWUSER_EMAIL_VERIFICATION)) {
+                        final String label = PwmSetting.NEWUSER_EMAIL_VERIFICATION.toMenuLocationDebug(newUserProfile.getIdentifier(),PwmConstants.DEFAULT_LOCALE);
+                        final String label2 = PwmSetting.TOKEN_STORAGEMETHOD.toMenuLocationDebug(null,PwmConstants.DEFAULT_LOCALE);
+                        returnRecords.add(HealthRecord.forMessage(HealthMessage.CryptoTokenWithNewUserVerification, label, label2));
+                    }
+                    if (newUserProfile.readSettingAsBoolean(PwmSetting.NEWUSER_SMS_VERIFICATION)) {
+                        final String label = PwmSetting.NEWUSER_SMS_VERIFICATION.toMenuLocationDebug(newUserProfile.getIdentifier(),PwmConstants.DEFAULT_LOCALE);
+                        final String label2 = PwmSetting.TOKEN_STORAGEMETHOD.toMenuLocationDebug(null,PwmConstants.DEFAULT_LOCALE);
+                        returnRecords.add(HealthRecord.forMessage(HealthMessage.CryptoTokenWithNewUserVerification, label, label2));
+                    }
                 }
             }
         }

+ 3 - 2
pwm/servlet/src/password/pwm/ws/server/rest/RestAppDataServer.java

@@ -45,6 +45,7 @@ import password.pwm.event.UserAuditRecord;
 import password.pwm.http.ContextManager;
 import password.pwm.http.PwmRequest;
 import password.pwm.http.PwmSession;
+import password.pwm.http.servlet.PwmServletDefinition;
 import password.pwm.i18n.Display;
 import password.pwm.i18n.LocaleHelper;
 import password.pwm.util.intruder.RecordType;
@@ -367,11 +368,11 @@ public class RestAppDataServer extends AbstractRestServer {
 
         final String contextPath = request.getContextPath();
         settingMap.put("url-context", contextPath);
-        settingMap.put("url-logout", contextPath + "/public/Logout?idle=true");
+        settingMap.put("url-logout", contextPath + "/public/logout?idle=true");
         settingMap.put("url-command", contextPath + "/public/CommandServlet");
         settingMap.put("url-resources", contextPath + "/public/resources" + pwmApplication.getResourceServletService().getResourceNonce());
         settingMap.put("url-restservice", contextPath + "/public/rest");
-        settingMap.put("url-setupresponses",contextPath + "/private/SetupResponses");
+        settingMap.put("url-setupresponses",contextPath + PwmServletDefinition.SetupResponses.servletUrl());
 
         {
             String passwordGuideText = pwmApplication.getConfig().readSettingAsLocalizedString(PwmSetting.DISPLAY_PASSWORD_GUIDE_TEXT,pwmSession.getSessionStateBean().getLocale());

+ 2 - 2
pwm/servlet/web/WEB-INF/jsp/setupresponses-confirm.jsp

@@ -67,7 +67,7 @@
         <% } %>
         <br/>
         <div class="buttonbar">
-            <form style="display: inline" action="<pwm:url url='SetupResponses'/>" method="post" name="changeResponses"
+            <form style="display: inline" action="<pwm:url url='<%=PwmServletDefinition.SetupResponses.servletUrlName()%>'/>" method="post" name="changeResponses"
                   enctype="application/x-www-form-urlencoded" class="pwm-form">
                 <button type="submit" name="confirm_btn" class="btn" id="confirm_btn">
                     <pwm:if test="showIcons"><span class="btn-icon fa fa-check"></span></pwm:if>
@@ -76,7 +76,7 @@
                 <input type="hidden" name="processAction" value="confirmResponses"/>
                 <input type="hidden" name="pwmFormID" value="<pwm:FormID/>"/>
             </form>
-            <form style="display: inline" action="<pwm:url url='SetupResponses'/>" method="post" name="confirmResponses"
+            <form style="display: inline" action="<pwm:url url='<%=PwmServletDefinition.SetupResponses.servletUrlName()%>'/>" method="post" name="confirmResponses"
                   enctype="application/x-www-form-urlencoded" class="pwm-form">
                 <button type="submit" name="change_btn" class="btn" id="change_btn">
                     <pwm:if test="showIcons"><span class="btn-icon fa fa-backward"></span></pwm:if>

+ 1 - 1
pwm/servlet/web/WEB-INF/jsp/setupresponses-existing.jsp

@@ -61,7 +61,7 @@
         <% } %>
         <br/>
         <div class="buttonbar">
-            <form style="display: inline" action="<pwm:url url='SetupResponses'/>" method="post" name="clearExistingForm" id="clearExistingForm"
+            <form style="display: inline" action="<pwm:url url='<%=PwmServletDefinition.SetupResponses.servletUrlName()%>'/>" method="post" name="clearExistingForm" id="clearExistingForm"
                   enctype="application/x-www-form-urlencoded" onsubmit="confirmContinue();return false">
                 <button type="submit" name="confirm_btn" class="btn" id="confirm_btn" value="">
                     <pwm:if test="showIcons"><span class="btn-icon fa fa-times"></span></pwm:if>

+ 2 - 1
pwm/servlet/web/WEB-INF/jsp/setupresponses-helpdesk.jsp

@@ -21,6 +21,7 @@
   --%>
 
 <%@ page import="password.pwm.http.bean.SetupResponsesBean" %>
+<%@ page import="password.pwm.http.servlet.PwmServletDefinition" %>
 <!DOCTYPE html>
 
 <%@ page language="java" session="true" isThreadSafe="true"
@@ -38,7 +39,7 @@
     </jsp:include>
     <div id="centerbody">
         <p><pwm:display key="Display_SetupHelpdeskResponses"/></p>
-        <form action="<pwm:url url='SetupResponses'/>" method="post" name="form-setupResponses"
+        <form action="<pwm:url url='<%=PwmServletDefinition.SetupResponses.servletUrlName()%>'/>" method="post" name="form-setupResponses"
               enctype="application/x-www-form-urlencoded" id="form-setupResponses" class="pwm-form">
             <%@ include file="fragment/message.jsp" %>
             <div id="pwm-setupResponsesDiv">

+ 1 - 1
pwm/servlet/web/WEB-INF/jsp/setupresponses.jsp

@@ -34,7 +34,7 @@
     </jsp:include>
     <div id="centerbody">
         <p><pwm:display key="Display_SetupResponses"/></p>
-        <form action="<pwm:url url='SetupResponses'/>" method="post" name="form-setupResponses" enctype="application/x-www-form-urlencoded" id="form-setupResponses" class="pwm-form">
+        <form action="<pwm:url url='<%=PwmServletDefinition.SetupResponses.servletUrlName()%>'/>" method="post" name="form-setupResponses" enctype="application/x-www-form-urlencoded" id="form-setupResponses" class="pwm-form">
             <%@ include file="fragment/message.jsp" %>
             <div id="pwm-setupResponsesDiv">
             <% request.setAttribute("setupData",responseBean.getResponseData()); %>

+ 1 - 1
pwm/servlet/web/public/resources/js/responses.js

@@ -179,7 +179,7 @@ PWM_RESPONSES.initSimpleRandomElements = function() {
         PWM_MAIN.addEventHandler(element.id,"focusin",function(){
             PWM_VAR['focusInValues'][element.id] = element.selectedIndex;
         });
-        PWM_MAIN.addEventHandler(element.id,"click",function(){
+        PWM_MAIN.addEventHandler(element.id,"click,blur",function(){
             if (PWM_VAR['focusInValues'][element.id] != element.selectedIndex) {
                 var selectedIndex = element.selectedIndex;
                 var selectedValue = element.options[selectedIndex].value;