Pārlūkot izejas kodu

hide persistent login button on config-login jsp when persistent login is not available

Jason Rivard 5 gadi atpakaļ
vecāks
revīzija
d4c029ed84

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

@@ -62,6 +62,7 @@ public enum PwmRequestAttribute
     ConfigHasPassword,
     ConfigPasswordRememberTime,
     ConfigLoginHistory,
+    ConfigEnablePersistentLogin,
     ApplicationPath,
 
     ConfigHasCertificates,

+ 4 - 1
server/src/main/java/password/pwm/http/servlet/configmanager/ConfigManagerLoginServlet.java

@@ -184,7 +184,9 @@ public class ConfigManagerLoginServlet extends AbstractPwmServlet
         final String time = TimeDuration.of( persistentSeconds, TimeDuration.Unit.SECONDS ).asLongString( pwmRequest.getLocale() );
 
         final ConfigLoginHistory configLoginHistory = readConfigLoginHistory( pwmRequest );
+        final boolean persistentLoginEnabled = persistentLoginEnabled( pwmRequest );
 
+        pwmRequest.setAttribute( PwmRequestAttribute.ConfigEnablePersistentLogin, persistentLoginEnabled );
         pwmRequest.setAttribute( PwmRequestAttribute.ConfigLoginHistory, configLoginHistory );
         pwmRequest.setAttribute( PwmRequestAttribute.ConfigPasswordRememberTime, time );
         pwmRequest.forwardToJsp( JspUrl.CONFIG_MANAGER_LOGIN );
@@ -424,7 +426,8 @@ public class ConfigManagerLoginServlet extends AbstractPwmServlet
 
     private static boolean persistentLoginEnabled(
             final PwmRequest pwmRequest
-    ) throws PwmUnrecoverableException
+    )
+            throws PwmUnrecoverableException
     {
         if ( PwmApplicationMode.RUNNING != pwmRequest.getPwmApplication().getApplicationMode() )
         {

+ 1 - 1
webapp/src/main/webapp/WEB-INF/jsp/configmanager-login.jsp

@@ -59,7 +59,7 @@
             <h1>Configuration Password</h1>
             <input type="<pwm:value name="<%=PwmValue.passwordFieldType%>"/>" class="inputfield passwordfield" name="password" id="password" placeholder="<pwm:display key="Field_Password"/>" <pwm:autofocus/>/>
             </div>
-            <% if (!pwmRequest.getConfig().isDefaultValue(PwmSetting.PWM_SECURITY_KEY)) { %>
+            <% if ( (Boolean)pwmRequest.getAttribute( PwmRequestAttribute.ConfigEnablePersistentLogin ) ) { %>
             <div class="checkboxWrapper">
                 <label>
                     <input type="checkbox" id="remember" name="remember"/>