Skip to content

Commit 00e51c9

Browse files
committed
dojo removal from user-facing jsps
1 parent aff15fd commit 00e51c9

37 files changed

+853
-1094
lines changed

docker/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<configuration>
4646
<skip>${skipDocker}</skip>
4747
<from>
48-
<image>eclipse-temurin:18-jre</image>
48+
<image>eclipse-temurin:20-jre</image>
4949
</from>
5050
<to>
5151
<image>${dockerImageTag}</image>

server/src/main/java/password/pwm/AppProperty.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public enum AppProperty
6767
CLIENT_FORM_CLIENT_REGEX_ENABLED ( "client.form.clientRegexEnable" ),
6868
CLIENT_WARNING_HEADER_SHOW ( "client.warningHeader.show" ),
6969
CLIENT_PW_SHOW_REVERT_TIMEOUT ( "client.pwShowRevertTimeout" ),
70-
CLIENT_JS_ENABLE_HTML5DIALOG ( "client.js.enableHtml5Dialog" ),
7170
CLIENT_JSP_SHOW_ICONS ( "client.jsp.showIcons" ),
7271
CONFIG_MAX_FILEVALUE_SIZE ( "config.max.fileValue.size" ),
7372
CONFIG_RELOAD_ON_CHANGE ( "config.reloadOnChange" ),

server/src/main/java/password/pwm/http/PwmRequestAttribute.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public enum PwmRequestAttribute
8888

8989
GuestCurrentExpirationDate,
9090
GuestMaximumExpirationDate,
91+
GuestMinimumExpirationDate,
9192
GuestMaximumValidDays,
9293

9394
NewUser_FormShowBackButton,

server/src/main/java/password/pwm/http/PwmRequestFlag.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public enum PwmRequestFlag
3232
NO_MOBILE_CSS,
3333
ALWAYS_EXPAND_MESSAGE_TEXT,
3434
INCLUDE_CONFIG_CSS,
35+
INCLUDE_DOJO,
3536
INCLUDE_IAS_ANGULAR,
3637
INCLUDE_IAS_CSS
3738
}

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

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import password.pwm.http.PwmSession;
4848
import password.pwm.http.PwmURL;
4949
import password.pwm.i18n.Display;
50-
import password.pwm.svc.sessiontrack.UserAgentUtils;
50+
import password.pwm.i18n.PwmDisplayBundle;
5151
import password.pwm.svc.stats.EpsStatistic;
5252
import password.pwm.svc.stats.Statistic;
5353
import password.pwm.svc.stats.StatisticsService;
@@ -310,46 +310,19 @@ private static Map<String, Object> makeClientData(
310310
settingMap.put( "client.ajaxTypingTimeout", Integer.parseInt( config.readAppProperty( AppProperty.CLIENT_AJAX_TYPING_TIMEOUT ) ) );
311311
settingMap.put( "client.ajaxTypingWait", Integer.parseInt( config.readAppProperty( AppProperty.CLIENT_AJAX_TYPING_WAIT ) ) );
312312
settingMap.put( "client.activityMaxEpsRate", Integer.parseInt( config.readAppProperty( AppProperty.CLIENT_ACTIVITY_MAX_EPS_RATE ) ) );
313-
settingMap.put( "client.js.enableHtml5Dialog", Boolean.parseBoolean( config.readAppProperty( AppProperty.CLIENT_JS_ENABLE_HTML5DIALOG ) ) );
314313
settingMap.put( "client.locale", LocaleHelper.getBrowserLocaleString( pwmSession.getSessionStateBean().getLocale() ) );
315314
settingMap.put( "client.pwShowRevertTimeout", Integer.parseInt( config.readAppProperty( AppProperty.CLIENT_PW_SHOW_REVERT_TIMEOUT ) ) );
316315
settingMap.put( "enableIdleTimeout", config.readSettingAsBoolean( PwmSetting.DISPLAY_IDLE_TIMEOUT ) );
317316
settingMap.put( "pageLeaveNotice", config.getAppConfig().readSettingAsLong( PwmSetting.SECURITY_PAGE_LEAVE_NOTICE_TIMEOUT ) );
318317
settingMap.put( "setting-showHidePasswordFields", pwmDomain.getConfig().readSettingAsBoolean( password.pwm.config.PwmSetting.DISPLAY_SHOW_HIDE_PASSWORD_FIELDS ) );
319318
settingMap.put( "setting-displayEula", PwmConstants.ENABLE_EULA_DISPLAY );
320319
settingMap.put( "setting-showStrengthMeter", config.readSettingAsBoolean( PwmSetting.PASSWORD_SHOW_STRENGTH_METER ) );
321-
322-
{
323-
final Optional<UserAgentUtils.BrowserType> optionalBrowserType = UserAgentUtils.getBrowserType( pwmRequest );
324-
final String browserTypeString = optionalBrowserType.isPresent() ? optionalBrowserType.get().toString() : "other";
325-
settingMap.put( "browserType", browserTypeString );
326-
}
327-
328-
{
329-
long idleSeconds = config.readSettingAsLong( PwmSetting.IDLE_TIMEOUT_SECONDS );
330-
if ( pageUrl == null || pageUrl.isEmpty() )
331-
{
332-
LOGGER.warn( pwmRequest, () -> "request to /client data did not include pageUrl" );
333-
}
334-
else
335-
{
336-
try
337-
{
338-
final PwmURL pwmUrl = PwmURL.create( URI.create( pageUrl ), pwmRequest.getContextPath(), pwmRequest.getAppConfig() );
339-
final TimeDuration maxIdleTime = IdleTimeoutCalculator.idleTimeoutForRequest( pwmRequest, pwmUrl );
340-
idleSeconds = maxIdleTime.as( TimeDuration.Unit.SECONDS );
341-
}
342-
catch ( final Exception e )
343-
{
344-
LOGGER.error( pwmRequest, () -> "error determining idle timeout time for request: " + e.getMessage() );
345-
}
346-
}
347-
settingMap.put( "MaxInactiveInterval", idleSeconds );
348-
}
349320
settingMap.put( "paramName.locale", config.readAppProperty( AppProperty.HTTP_PARAM_NAME_LOCALE ) );
350321
settingMap.put( "runtimeNonce", pwmDomain.getPwmApplication().getRuntimeNonce() );
351322
settingMap.put( "applicationMode", pwmDomain.getApplicationMode() );
352323

324+
settingMap.putAll( makeIdleTimeoutClientData( pwmRequest, config, pageUrl ) );
325+
353326
{
354327
final String contextPath = pwmRequest.getBasePath();
355328
settingMap.put( "url-context", contextPath );
@@ -433,7 +406,7 @@ private Map<String, String> makeDisplayData(
433406
)
434407
{
435408
final PwmSession pwmSession = pwmRequest.getPwmSession();
436-
final Class displayClass = LocaleHelper.classForShortName( bundleName ).orElse( Display.class );
409+
final Class<? extends PwmDisplayBundle> displayClass = LocaleHelper.classForShortName( bundleName ).orElse( Display.class );
437410

438411
final Locale userLocale = pwmSession.getSessionStateBean().getLocale();
439412
final DomainConfig config = pwmDomain.getConfig();
@@ -530,5 +503,33 @@ private void precheckPublicHealthAndStats( final PwmRequest pwmRequest )
530503
}
531504
}
532505
}
506+
507+
508+
private static Map<String, Object> makeIdleTimeoutClientData(
509+
final PwmRequest pwmRequest,
510+
final DomainConfig config,
511+
final String pageUrl )
512+
{
513+
long idleSeconds = config.readSettingAsLong( PwmSetting.IDLE_TIMEOUT_SECONDS );
514+
if ( StringUtil.isEmpty( pageUrl ) )
515+
{
516+
LOGGER.warn( pwmRequest, () -> "request to /client data did not include pageUrl" );
517+
}
518+
else
519+
{
520+
try
521+
{
522+
final PwmURL pwmUrl = PwmURL.create( URI.create( pageUrl ), pwmRequest.getContextPath(), pwmRequest.getAppConfig() );
523+
final TimeDuration maxIdleTime = IdleTimeoutCalculator.idleTimeoutForRequest( pwmRequest, pwmUrl );
524+
idleSeconds = maxIdleTime.as( TimeDuration.Unit.SECONDS );
525+
}
526+
catch ( final Exception e )
527+
{
528+
LOGGER.error( pwmRequest, () -> "error determining idle timeout time for request: " + e.getMessage() );
529+
}
530+
}
531+
532+
return Collections.singletonMap( "MaxInactiveInterval", idleSeconds );
533+
}
533534
}
534535

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ private void calculateFutureDateFlags( final PwmRequest pwmRequest, final GuestR
686686
final long maxValidDays = pwmRequest.getDomainConfig().readSettingAsLong( PwmSetting.GUEST_MAX_VALID_DAYS );
687687
pwmRequest.setAttribute( PwmRequestAttribute.GuestMaximumValidDays, String.valueOf( maxValidDays ) );
688688

689+
pwmRequest.setAttribute( PwmRequestAttribute.GuestMinimumExpirationDate, dateFormat.format( Instant.now() ) );
690+
689691

690692
final String maxExpirationDate;
691693
{

server/src/main/java/password/pwm/http/servlet/newuser/NewUserUtils.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,15 @@ static UserInfoBean createUserInfoBeanForNewUser(
497497

498498
final String usernameAttribute = newUserProfile.getLdapProfile( pwmDomain.getConfig() ).readSettingAsString( PwmSetting.LDAP_USERNAME_ATTRIBUTE );
499499

500+
final String username = formValues.getOrDefault( usernameAttribute, "_NewUser_" );
501+
502+
final UserIdentity userIdentity = UserIdentity.create(
503+
username,
504+
newUserProfile.getLdapProfile( pwmDomain.getConfig() ).getId(),
505+
pwmDomain.getDomainID() );
506+
500507
return UserInfoBean.builder()
508+
.userIdentity( userIdentity )
501509
.userEmailAddress( formValues.get( emailAddressAttribute ) )
502510
.username( formValues.get( usernameAttribute ) )
503511
.attributes( formValues )
@@ -768,7 +776,7 @@ static ProcessStatus checkForTokenVerificationProgress(
768776
TokenUtil.initializeAndSendToken(
769777
pwmRequest.getPwmRequestContext(),
770778
TokenUtil.TokenInitAndSendRequest.builder()
771-
.userInfo( null )
779+
.userInfo( macroRequest.getUserInfo() )
772780
.tokenDestinationItem( tokenDestinationItem )
773781
.emailToSend( PwmSetting.EMAIL_NEWUSER_VERIFICATION )
774782
.tokenType( TokenType.NEWUSER )

server/src/main/java/password/pwm/util/macro/UserMacros.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public String replaceValue(
115115
throw new MacroParseException( "too many parameters" );
116116
}
117117

118-
final String ldapValue = readLdapValue( macroRequest, ldapAttr, matchValue );
118+
final String ldapValue = readLdapValue( macroRequest, ldapAttr, matchValue );
119119

120120
final StringBuilder returnValue = new StringBuilder();
121121
returnValue.append( ldapValue == null
@@ -747,23 +747,30 @@ public String replaceValue(
747747
throws MacroParseException
748748
{
749749
final UserInfo userInfo = request.getUserInfo();
750-
if ( userInfo != null )
750+
if ( userInfo == null )
751751
{
752-
final UserIdentity userIdentity = userInfo.getUserIdentity();
753-
if ( userIdentity != null )
754-
{
755-
final DomainID domainID = userIdentity.getDomainID();
756-
if ( domainID != null )
757-
{
758-
final PwmDomain pwmDomain = request.getPwmApplication().domains().get( domainID );
759-
if ( pwmDomain != null )
760-
{
761-
return pwmDomain.getConfig().readSettingAsString( PwmSetting.EMAIL_DOMAIN_FROM_ADDRESS );
762-
}
763-
}
764-
}
752+
throw new MacroParseException( "[DefaultEmailFromAddress]: userInfo unspecified on macro request" );
765753
}
766-
throw new MacroParseException( "@DefaultEmailFromAddress@: domain unspecified on macro request" );
754+
755+
final UserIdentity userIdentity = userInfo.getUserIdentity();
756+
if ( userIdentity == null )
757+
{
758+
throw new MacroParseException( "[DefaultEmailFromAddress]: userIdentity unspecified on macro request" );
759+
}
760+
761+
final DomainID domainID = userIdentity.getDomainID();
762+
if ( domainID == null )
763+
{
764+
throw new MacroParseException( "[DefaultEmailFromAddress]: domain unspecified on macro request" );
765+
}
766+
767+
final PwmDomain pwmDomain = request.getPwmApplication().domains().get( domainID );
768+
if ( pwmDomain == null )
769+
{
770+
throw new MacroParseException( "[DefaultEmailFromAddress]: domain invalid on macro request" );
771+
}
772+
773+
return pwmDomain.getConfig().readSettingAsString( PwmSetting.EMAIL_DOMAIN_FROM_ADDRESS );
767774
}
768775
}
769776

server/src/main/resources/password/pwm/AppProperty.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ client.formNonce.length=10
5555
client.form.clientRegexEnable=true
5656
client.warningHeader.show=true
5757
client.pwShowRevertTimeout=45000
58-
client.js.enableHtml5Dialog=true
5958
client.jsp.showIcons=true
6059
cluster.db.enable=true
6160
cluster.db.heartbeatSeconds=60

webapp/src/main/webapp/WEB-INF/jsp/changepassword-wait.jsp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@
5353
<%@ include file="/WEB-INF/jsp/fragment/message.jsp" %>
5454
<p><pwm:display key="Display_PleaseWaitPassword"/></p>
5555
<div class="meteredProgressBar">
56-
<progress id="html5ProgressBar" max="100" value="0">
57-
<div data-dojo-type="dijit/ProgressBar" style="width:100%" data-dojo-id="passwordProgressBar" id="passwordProgressBar" data-dojo-props="maximum:100"></div>
58-
</progress>
56+
<progress id="html5ProgressBar" max="100" value="0">
57+
</progress>
5958
</div>
6059
<div style="text-align: center; width: 100%; padding-top: 50px">
6160
<%--
@@ -70,14 +69,11 @@
7069
<div class="push"></div>
7170
</div>
7271
<pwm:script>
73-
<script type="text/javascript">
74-
PWM_GLOBAL['startupFunctions'].push(function(){
75-
require(["dojo/parser", "dijit/ProgressBar","dojo/ready"], function(parser){
76-
parser.parse();
72+
<script type="text/javascript">
73+
PWM_GLOBAL['startupFunctions'].push(function(){
7774
PWM_CHANGEPW.refreshCreateStatus(<%=checkIntervalSeconds * 1000%>);
7875
});
79-
});
80-
</script>
76+
</script>
8177
</pwm:script>
8278
<pwm:script-ref url="/public/resources/js/changepassword.js"/>
8379
<%@ include file="/WEB-INF/jsp/fragment/footer.jsp" %>

0 commit comments

Comments
 (0)