keep me signed in
This commit is contained in:
parent
1262b12ee4
commit
33d60446f1
@ -38,9 +38,15 @@ export default (router, tpl) => {
|
||||
browser: req.headers["user-agent"],
|
||||
created_at: stamp,
|
||||
last_used: stamp,
|
||||
last_action: "/login"
|
||||
last_action: "/login",
|
||||
kmsi: req.post.kmsi === 'on' ? 1 : 0
|
||||
});
|
||||
|
||||
await sql("user_sessions") // delete unused sessions
|
||||
.where('last_action', '<=', (Date.now() - 6048e5))
|
||||
.andWhere('kmsi', 0)
|
||||
.del();
|
||||
|
||||
return res.writeHead(301, {
|
||||
"Cache-Control": "no-cache, public",
|
||||
"Set-Cookie": `session=${session}; Path=/; Expires=Fri, 31 Dec 9999 23:59:59 GMT`,
|
||||
|
@ -11,6 +11,7 @@
|
||||
<p><a href="/"><img src="/s/img/f0ck_small.png" /></a></p>
|
||||
<input type="text" name="username" placeholder="username" autocomplete="off" required />
|
||||
<input type="password" name="password" placeholder="password" autocomplete="off" required />
|
||||
<p><input type="checkbox" id="kmsi" name="kmsi" /> <label for="kmsi">stay signed in</label></p>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</body>
|
||||
|
@ -26,6 +26,7 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>id</th>
|
||||
<th>created_at</th>
|
||||
<th>last_used</th>
|
||||
@ -36,6 +37,7 @@
|
||||
<tbody>
|
||||
@each(sessions as sess)
|
||||
<tr@if(sess.id === session.sess_id) style="background-color: rgb(0, 89, 0)"@endif>
|
||||
<td>{{ sess.kmsi ? '⚓' : '' }}</td>
|
||||
<td tooltip="{{ sess.browser }}" flow="right">{{ sess.id }}</td>
|
||||
<td>{{ new Date(sess.created_at * 1e3).toLocaleString("de-DE") }}</td>
|
||||
<td>{{ new Date(sess.last_used * 1e3).toLocaleString("de-DE") }}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user