Browse Source

Disconnected the cancel button from the submit form, so it would redirect properly to the home page.

Also had to set the dirtyPageLeaveFlag in main.js, since IE was asking for confirmation to leave the page when you submitted the change password form.
James Albright 9 years ago
parent
commit
a93d0337e7

+ 18 - 12
src/main/webapp/WEB-INF/jsp/changepassword.jsp

@@ -104,18 +104,25 @@
                     <td style="border:0; width:10%">&nbsp;</td>
                 </tr>
             </table>
-            <div class="buttonbar" style="width:100%">
-                <input type="hidden" name="processAction" value="change"/>
-                <button type="submit" name="change" class="btn" id="password_button">
-                    <pwm:if test="<%=PwmIfTest.showIcons%>"><span class="btn-icon pwm-icon pwm-icon-forward"></span></pwm:if>
-                    <pwm:display key="Button_ChangePassword"/>
-                </button>
-                <% if (!passwordStatus.isExpired() && !passwordStatus.isPreExpired() && !passwordStatus.isViolatesPolicy()) { %>
-                <%@ include file="/WEB-INF/jsp/fragment/cancel-button.jsp" %>
-                <% } %>
-                <input type="hidden" name="pwmFormID" id="pwmFormID" value="<pwm:FormID/>"/>
-            </div>
+
+            <input type="hidden" name="processAction" value="change"/>
+            <input type="hidden" name="pwmFormID" id="pwmFormID" value="<pwm:FormID/>"/>
         </form>
+
+        <div class="buttonbar" style="width:100%">
+            <button type="submit" name="change" class="btn" id="password_button" form="changePasswordForm">
+                <pwm:if test="<%=PwmIfTest.showIcons%>"><span class="btn-icon pwm-icon pwm-icon-forward"></span></pwm:if>
+                <pwm:display key="Button_ChangePassword"/>
+            </button>
+            <% if (!passwordStatus.isExpired() && !passwordStatus.isPreExpired() && !passwordStatus.isViolatesPolicy()) { %>
+                <form action="<pwm:url addContext='true' url='/' />" method="GET">
+                    <button type="submit" name="change" class="btn">
+                        <pwm:if test="<%=PwmIfTest.showIcons%>"><span class="btn-icon pwm-icon pwm-icon-forward"></span></pwm:if>
+                        <pwm:display key="Button_Cancel"/>
+                    </button>
+                </form>
+            <% } %>
+        </div>
     </div>
     <div class="push"></div>
 </div>
@@ -126,7 +133,6 @@
     });
 </script>
 </pwm:script>
-<%@ include file="/WEB-INF/jsp/fragment/cancel-form.jsp" %>
 <pwm:script-ref url="/public/resources/js/changepassword.js"/>
 <%@ include file="fragment/footer.jsp" %>
 </body>

+ 1 - 0
src/main/webapp/public/resources/js/main.js

@@ -269,6 +269,7 @@ PWM_MAIN.applyFormAttributes = function() {
         console.log('added event handler for submit button with form attribute ' + element.id);
         PWM_MAIN.addEventHandler(element,'click',function(e){
             PWM_MAIN.stopEvent(e);
+            PWM_VAR['dirtyPageLeaveFlag'] = false;
             var formID = element.getAttribute('form');
             PWM_MAIN.handleFormSubmit(PWM_MAIN.getObject(formID));
         });