summaryrefslogtreecommitdiffstats
path: root/modules-available/session
diff options
context:
space:
mode:
authorSimon Rettberg2021-05-05 14:54:41 +0200
committerSimon Rettberg2021-05-11 14:50:11 +0200
commite40d692a02494641407cbcaf1cea2f6070d418f0 (patch)
tree418455aa61df6790909ae44a14c982e6a53b30c5 /modules-available/session
parent[session] Add option to bind session to IP address (diff)
downloadslx-admin-e40d692a02494641407cbcaf1cea2f6070d418f0.tar.gz
slx-admin-e40d692a02494641407cbcaf1cea2f6070d418f0.tar.xz
slx-admin-e40d692a02494641407cbcaf1cea2f6070d418f0.zip
[session] Add simple session overview table
Diffstat (limited to 'modules-available/session')
-rw-r--r--modules-available/session/lang/de/template-tags.json6
-rw-r--r--modules-available/session/lang/en/template-tags.json6
-rw-r--r--modules-available/session/page.inc.php11
-rw-r--r--modules-available/session/templates/change-password.html31
4 files changed, 50 insertions, 4 deletions
diff --git a/modules-available/session/lang/de/template-tags.json b/modules-available/session/lang/de/template-tags.json
index fb594521..491c7cc3 100644
--- a/modules-available/session/lang/de/template-tags.json
+++ b/modules-available/session/lang/de/template-tags.json
@@ -1,10 +1,14 @@
{
+ "lang_activeSessions": "Bekannte Sitzungen",
"lang_changePassword": "Passwort \u00e4ndern",
"lang_currentPassword": "Aktuelles Passwort",
"lang_enter": "Anmeldung",
+ "lang_expires": "L\u00e4uft bei Inaktivit\u00e4t ab",
"lang_fixedIpSession": "Sitzung an IP-Adresse binden",
+ "lang_lastAddress": "Letzter Zugriff von",
"lang_login": "Anmelden",
"lang_newPassword": "Neues Passwort",
"lang_register": "Registrieren",
- "lang_repeatPassword": "Passwort wiederholen"
+ "lang_repeatPassword": "Passwort wiederholen",
+ "lang_uid": "User#"
} \ No newline at end of file
diff --git a/modules-available/session/lang/en/template-tags.json b/modules-available/session/lang/en/template-tags.json
index 77854ce6..0bd192f3 100644
--- a/modules-available/session/lang/en/template-tags.json
+++ b/modules-available/session/lang/en/template-tags.json
@@ -1,10 +1,14 @@
{
+ "lang_activeSessions": "Known sessions",
"lang_changePassword": "Change password",
"lang_currentPassword": "Current password",
"lang_enter": "Enter",
+ "lang_expires": "Expires on no activity",
"lang_fixedIpSession": "Bind session to IP address",
+ "lang_lastAddress": "Last access from",
"lang_login": "Login",
"lang_newPassword": "New password",
"lang_register": "Register",
- "lang_repeatPassword": "Repeat password"
+ "lang_repeatPassword": "Repeat password",
+ "lang_uid": "User#"
} \ No newline at end of file
diff --git a/modules-available/session/page.inc.php b/modules-available/session/page.inc.php
index 1af5280c..303415fe 100644
--- a/modules-available/session/page.inc.php
+++ b/modules-available/session/page.inc.php
@@ -62,7 +62,16 @@ class Page_Session extends Page
protected function doRender()
{
if (User::isLoggedIn()) {
- Render::addTemplate('change-password');
+ $res = Database::simpleQuery("SELECT userid, dateline, lastip, fixedip FROM session ORDER BY dateline DESC");
+ $sessions = [];
+ $perm = User::hasPermission('.adduser.user.*');
+ while ($row = $res->fetch()) {
+ if ($perm || $row['userid'] == User::getId()) {
+ $row['dateline_s'] = Util::prettyTime($row['dateline']);
+ $sessions[] = $row;
+ }
+ }
+ Render::addTemplate('change-password', ['sessions' => $sessions]);
} else {
Render::addTemplate('page-login');
}
diff --git a/modules-available/session/templates/change-password.html b/modules-available/session/templates/change-password.html
index 70ab7b92..fa8e573f 100644
--- a/modules-available/session/templates/change-password.html
+++ b/modules-available/session/templates/change-password.html
@@ -8,4 +8,33 @@
<button class="btn btn-lg btn-primary btn-block" type="submit">{{lang_changePassword}}</button>
<input type="hidden" name="action" value="changepw">
<input type="hidden" name="token" value="{{token}}">
-</form> \ No newline at end of file
+</form>
+
+<h2>{{lang_activeSessions}}</h2>
+<table class="table">
+ <thead>
+ <tr>
+ <th>{{lang_uid}}</th>
+ <th>{{lang_expires}}</th>
+ <th>{{lang_lastAddress}}</th>
+ <th class="slx-smallcol">{{lang_fixedIpSession}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#sessions}}
+ <tr>
+ <td>{{userid}}</td>
+ <td>{{dateline_s}}</td>
+ <td>{{lastip}}</td>
+ <td class="text-nowrap">
+ {{#fixedip}}
+ <span class="glyphicon glyphicon-ok"></span>
+ {{/fixedip}}
+ {{^fixedip}}
+ <span class="glyphicon glyphicon-remove"></span>
+ {{/fixedip}}
+ </td>
+ </tr>
+ {{/sessions}}
+ </tbody>
+</table> \ No newline at end of file