Skip to content

Commit b202f31

Browse files
author
jrivard@gmail.com
committed
minor ui and i18n issues
1 parent 149985a commit b202f31

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

server/src/main/java/password/pwm/http/bean/SetupResponsesBean.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class SetupResponsesBean extends PwmSessionBean
4545
private boolean helpdeskResponsesSatisfied;
4646
private boolean confirmed;
4747
private Locale userLocale;
48+
private boolean initialized;
4849

4950
public Type getType( )
5051
{

server/src/main/java/password/pwm/http/servlet/SetupResponsesServlet.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,20 @@ public Class<? extends ProcessAction> getProcessActionsClass( )
122122

123123
private SetupResponsesBean getSetupResponseBean( final PwmRequest pwmRequest ) throws PwmUnrecoverableException
124124
{
125-
return pwmRequest.getPwmApplication().getSessionStateService().getBean( pwmRequest, SetupResponsesBean.class );
125+
final SetupResponsesBean setupResponsesBean = pwmRequest.getPwmApplication().getSessionStateService().getBean( pwmRequest, SetupResponsesBean.class );
126+
if ( !setupResponsesBean.isInitialized() )
127+
{
128+
initializeBean( pwmRequest, setupResponsesBean );
129+
}
130+
return setupResponsesBean;
131+
126132
}
127133

128134
@Override
129135
public ProcessStatus preProcessCheck( final PwmRequest pwmRequest ) throws PwmUnrecoverableException, IOException, ServletException
130136
{
131137
final PwmSession pwmSession = pwmRequest.getPwmSession();
132138
final PwmApplication pwmApplication = pwmRequest.getPwmApplication();
133-
final SetupResponsesBean setupResponsesBean = getSetupResponseBean( pwmRequest );
134139

135140
if ( !pwmSession.isAuthenticated() )
136141
{
@@ -161,10 +166,10 @@ public ProcessStatus preProcessCheck( final PwmRequest pwmRequest ) throws PwmUn
161166
pwmApplication.getSessionStateService().getBean( pwmRequest, SetupResponsesBean.class ).setUserLocale( pwmSession.getSessionStateBean().getLocale() );
162167
}
163168

164-
initializeBean( pwmRequest, setupResponsesBean );
165-
166169
// check to see if the user has any challenges assigned
167170
final UserInfo uiBean = pwmSession.getUserInfo();
171+
final SetupResponsesBean setupResponsesBean = getSetupResponseBean( pwmRequest );
172+
168173
if ( setupResponsesBean.getResponseData().getChallengeSet() == null || setupResponsesBean.getResponseData().getChallengeSet().getChallenges().isEmpty() )
169174
{
170175
final String errorMsg = "no challenge sets configured for user " + uiBean.getUserIdentity();

server/src/main/resources/password/pwm/i18n/Display.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ Title_TitleBarAuthenticated=@User:ID@ Password Self Service
355355
Title_TitleBar=Password Self Service
356356
Title_UpdateProfile=Update Profile
357357
Title_UpdateProfileConfirm=Confirm Profile Data
358+
Title_Upload=Upload
358359
Title_UploadPhoto=Upload Photo
359360
Title_UserData=My Data
360361
Title_UserEventHistory=Password History

webapp/src/main/webapp/WEB-INF/jsp/fragment/form.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
</script>
129129
</pwm:script>
130130
<% if (!StringUtil.isEmpty( currentValue) ) { %>
131-
<button type="submit" id="button-deletePhoto-<%=loopConfiguration.getName()%>" name="<%=loopConfiguration.getName()%>" class="btn" title="<pwm:display key="Button_Delete"/>" form="form-deletePhoto-<%=loopConfiguration.getName()%>">
131+
<button type="button" id="button-deletePhoto-<%=loopConfiguration.getName()%>" name="<%=loopConfiguration.getName()%>" class="btn" title="<pwm:display key="Button_Delete"/>">
132132
<pwm:if test="<%=PwmIfTest.showIcons%>"><span class="btn-icon pwm-icon pwm-icon-times"></span></pwm:if>
133133
<pwm:display key="Button_Delete"/>
134134
</button>

webapp/src/main/webapp/public/resources/js/main.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,10 @@ PWM_MAIN.applyFormAttributes = function() {
285285
require(["dojo"], function (dojo) {
286286
if(dojo.isIE){
287287
PWM_MAIN.doQuery("button[type=submit][form]",function(element){
288-
PWM_MAIN.log('added event handler for submit button with form attribute ' + element.id);
288+
PWM_MAIN.log('added IE event handler for submit button with form attribute ' + element.id);
289289
PWM_MAIN.addEventHandler(element,'click',function(e){
290-
PWM_MAIN.stopEvent(e);
290+
e.preventDefault();
291+
PWM_MAIN.log('IE event handler intercepted submit for referenced form attribute ' + element.id);
291292
var formID = element.getAttribute('form');
292293
PWM_MAIN.handleFormSubmit(PWM_MAIN.getObject(formID));
293294
});
@@ -424,11 +425,13 @@ PWM_MAIN.handleFormSubmit = function(form, event) {
424425
PWM_MAIN.cancelEvent(event);
425426

426427
PWM_GLOBAL['idle_suspendTimeout'] = true;
427-
var formElements = form.elements;
428-
for (var i = 0; i < formElements.length; i++) {
429-
formElements[i].readOnly = true;
430-
if (formElements[i].type === 'button' || formElements[i].type === 'submit') {
431-
formElements[i].disabled = true;
428+
if ( form.elements ) {
429+
var formElements = form.elements;
430+
for (var i = 0; i < formElements.length; i++) {
431+
formElements[i].readOnly = true;
432+
if (formElements[i].type === 'button' || formElements[i].type === 'submit') {
433+
formElements[i].disabled = true;
434+
}
432435
}
433436
}
434437

webapp/src/main/webapp/public/resources/js/responses.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ PWM_RESPONSES.validateResponses=function() {
5757
};
5858

5959
PWM_RESPONSES.updateDisplay=function(resultInfo) {
60-
if (resultInfo === null) {
60+
if (!resultInfo) {
6161
PWM_MAIN.getObject("button-setResponses").disabled = false;
6262
return;
6363
}

webapp/src/main/webapp/public/resources/js/uilibrary.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,12 @@ UILibrary.uploadFileDialog = function(options) {
454454
body += '<div id="fileList"></div>';
455455
body += '<input style="width:80%" class="btn" name="uploadFile" type="file" label="Select File" id="uploadFile"/>';
456456
body += '<div class="buttonbar">';
457-
body += '<button class="btn" type="button" id="uploadButton" name="Upload" disabled><span class="pwm-icon pwm-icon-upload"></span> Upload</button>';
458-
body += '</div></div>';
457+
body += '<button class="btn" type="button" id="uploadButton" name="Upload" disabled><span class="pwm-icon pwm-icon-upload"></span>';
458+
body += PWM_MAIN.showString('Button_Upload') + '</button></div></div>';
459459

460460
var currentUrl = window.location.pathname;
461461
var uploadUrl = 'url' in options ? options['url'] : currentUrl;
462-
var title = 'title' in options ? options['title'] : 'Upload File';
462+
var title = 'title' in options ? options['title'] : PWM_MAIN.showString('Title_Upload');
463463

464464
uploadUrl = PWM_MAIN.addPwmFormIDtoURL(uploadUrl);
465465

0 commit comments

Comments
 (0)