Skip to content

Commit a0c9411

Browse files
Add session timeout screen
1 parent 7c95f67 commit a0c9411

10 files changed

+41
-4
lines changed

locales/en.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,8 @@
8787
"resetPasswordSent_title": "Password recovery",
8888
"resetPasswordForm_title": "Password recovery",
8989
"resetPasswordSuccess_title": "Password changed",
90-
"resetPassword_title": "Password recovery"
90+
"resetPassword_title": "Password recovery",
91+
"timeout_title": "Session timeout",
92+
"timeout_SessionTimeout": "Your session has timed out, please log in again",
93+
"timeout_ReturnTo": "Return to "
9194
}

locales/fi.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,8 @@
8787
"resetPasswordSent_title": "Salasanan palautus",
8888
"resetPasswordForm_title": "Salasanan palautus",
8989
"resetPasswordSuccess_title": "Salasana palautettu",
90-
"resetPassword_title": "Salasanan palautus"
90+
"resetPassword_title": "Salasanan palautus",
91+
"timeout_title": "Vanhentunut istunto",
92+
"timeout_SessionTimeout": "Istuntosi on vanhentunut, kirjaudu sisään uudelleen",
93+
"timeout_ReturnTo": "Palaa osoitteeseen "
9194
}

src/controllers/LoginController.ts

+5
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,10 @@ class LoginController implements Controller {
583583
}
584584
}
585585

586+
public timeout: RequestHandler = async (_req, res) => {
587+
return res.render("timeout")
588+
}
589+
586590
public createRoutes(): express.Router {
587591
this.route.get("/", cachingMiddleware, AuthorizeMiddleware.loadToken, this.getLoginView);
588592
this.route.post(
@@ -607,6 +611,7 @@ class LoginController implements Controller {
607611
this.loginConfirm,
608612
);
609613
this.route.get("/logout", AuthorizeMiddleware.authorize(false), this.logOut);
614+
this.route.get("/timeout", this.timeout);
610615
this.route.get("/reset-password", this.resetPassword.bind(this));
611616
this.route.post("/reset-password", checkCsrf, this.resetPassword.bind(this));
612617

views/gdpr.pug

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
extends layouts/common.pug
22

3-
block append head
3+
append head
4+
//- Redirect to /timeout in 5 minutes
5+
meta(http-equiv="refresh", content="300;url=/timeout")
46
link(rel="stylesheet", href="/styles/gdpr.css")
57

68
block content

views/login.pug

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
extends layouts/common.pug
22

3+
append head
4+
//- Redirect to /timeout in 5 minutes
5+
meta(http-equiv="refresh", content="300;url=/timeout")
6+
37
block content
48
#login
59
if (loggedUser && logoutRedirect)

views/privacypolicy.pug

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
extends layouts/common.pug
22

3-
block append head
3+
append head
4+
//- Redirect to /timeout in 5 minutes
5+
meta(http-equiv="refresh", content="300;url=/timeout")
46
link(rel="stylesheet", href="/styles/termsAndConditions.css")
57

68
block title

views/resetPassword.pug

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
extends layouts/common.pug
22

3+
append head
4+
//- Redirect to /timeout in 5 minutes
5+
meta(http-equiv="refresh", content="300;url=/timeout")
6+
37
block content
48
form#loginForm(action=submitUrl || "/reset-password", method="POST")
59
input(type="hidden", name="method", value=method)

views/resetPasswordChoice.pug

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
extends layouts/common.pug
22

3+
append head
4+
//- Redirect to /timeout in 5 minutes
5+
meta(http-equiv="refresh", content="300;url=/timeout")
6+
37
block content
48
form#loginForm(action=submitUrl || "/reset-password", method="GET")
59
p #{ t("resetPassword_choiceMessage") }

views/resetPasswordForm.pug

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
extends layouts/common.pug
22

3+
append head
4+
//- Redirect to /timeout in 5 minutes
5+
meta(http-equiv="refresh", content="300;url=/timeout")
6+
37
block content
48
form#loginForm(action=submitUrl || "/reset-password", method="POST")
59
p #{ t("resetPassword_formMessage") }

views/timeout.pug

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extends layouts/common.pug
2+
3+
block content
4+
.error-message
5+
span.error-text #{ t("timeout_SessionTimeout") }.
6+
a(href="https://tko-aly.fi") #{ t("timeout_ReturnTo") } tko-aly.fi

0 commit comments

Comments
 (0)