Skip to content

Commit

Permalink
Attempt to add redirect on session timeout.
Browse files Browse the repository at this point in the history
WIP: Still needs work.
  • Loading branch information
bseeger committed May 23, 2024
1 parent f883961 commit 68f5297
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ dependencies {
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.17.1'
implementation 'com.opencsv:opencsv:5.9'

implementation "org.codeforamerica.platform:form-flow:${formFlowLibraryVersion}"
println "📚Using form flow library ${formFlowLibraryVersion}"
if (profile == 'dev' || useLocalLibrary == 'true') {
implementation fileTree(dir: "$rootDir/../form-flow/build/libs", include: '*.jar')
println "📦 Using local library"
} else {
implementation "org.codeforamerica.platform:form-flow:${formFlowLibraryVersion}"
println "📚Using form flow library ${formFlowLibraryVersion}"
}

implementation 'com.amazonaws:aws-encryption-sdk-java:3.0.0'
implementation 'org.bouncycastle:bcpg-jdk15on:1.70'
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/mdbenefits/app/StaticPageController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public class StaticPageController {
@GetMapping("/")
ModelAndView getIndex(HttpServletRequest request) {
HttpSession httpSession = request.getSession(false);

if (httpSession != null) {
httpSession.invalidate();
}

Map<String, Object> model = new HashMap<>();
model.put("screen", "/");
model.put("sessionBad", request.getParameter("sessionBad"));
return new ModelAndView("index", model);
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
form-flow:
session-continuity-interceptor:
enabled: true
redirect-url: '/?sessionTimeout=true'
lock-after-submitted:
- flow: mdBenefitsFlow
redirect: confirmation
Expand Down Expand Up @@ -77,7 +78,7 @@ spring:
max-file-size: ${form-flow.uploads.max-file-size}MB
max-request-size: ${form-flow.uploads.max-file-size}MB
session:
timeout: 30M
timeout: 5M
store-type: jdbc
jdbc:
initialize-schema: always
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ general.good-news=Good news!
general.i-dont-know=I don't know
general.not-interested=No, I\u2019m not interested
general.ok-thanks=Ok, thanks
general.session-timeout=Your browser session expired. To protect your data, the session expires after 30 minutes of inactivity on this website.
error.character-length=Provide an account number with less than 30 characters.
error.error=Error
error.uh-oh=Uh oh!
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/static/assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -514,4 +514,9 @@ li li {
.email-confirmation-text {
color: #00891B;
font-weight: bold;
}

.session-timeout-message {
padding: 2rem;
background-color: #ED9B06
}
5 changes: 5 additions & 0 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<div>
<th:block th:replace="~{fragments/icons :: nextSteps}"></th:block>
</div>
<th:block th:if="${sessionBad != null && sessionBad.equalsIgnoreCase('true')}">
<div class="session-timeout-message spacing-above-35">
<p th:text="#{general.session-timeout}"></p>
</div>
</th:block>
<h1 class="spacing-below-15 spacing-above-0" th:utext="#{index.header}"></h1>
<p class="spacing-below-95" th:utext="#{index.description}"></p>
<a id="apply_now" th:href="#{index.apply-now.link}"
Expand Down

0 comments on commit 68f5297

Please sign in to comment.