This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(User): User can manager their own sessions
Since We add the max per user session number limit, It is importortant for user can manager (or you can say revoke) their session. So in this commit, 1. Add `/user/sessions` as user sessions manager route. 2. User Login out with Session expired in database.
- Loading branch information
Showing
5 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{% extends "user/setting_layout.html.twig" %} | ||
|
||
{% block panel %} | ||
<h1>Sessions</h1> | ||
<hr> | ||
This is a list of devices that have logged into your account. Revoke any sessions that you do not recognize. | ||
<br> | ||
<br> | ||
<table class="table table-striped table-bordered table-hover"> | ||
<thead> | ||
<tr> | ||
<td class="text-center">Login At</td> | ||
<td class="text-center">Login IP</td> | ||
<td class="text-center">Platform</td> | ||
<td class="text-center">Browser</td> | ||
<td class="text-center">Last access at</td> | ||
<td class="text-center">Action</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for s in sessions %} | ||
<tr> | ||
<td class="text-center">{{ s['login_at'] | date("Y-m-d H:i:s") }}</td> | ||
<td class="text-center">{{ s['login_ip'] }}</td> | ||
<td class="text-center">{{ s['platform'] }}</td> | ||
<td class="text-center">{{ s['browser'] }}</td> | ||
<td class="text-center">{{ s['last_access_at'] | date("Y-m-d H:i:s") }}</td> | ||
<td class="text-center"> | ||
{% if s['sid'] == curuser.getSessionId() %} | ||
Current | ||
{% else %} | ||
<form method="post"> | ||
<input type="hidden" name="action" value="delsession"/> | ||
<input type="hidden" name="session" value="{{ s['sid'] }}"/> | ||
<button class="btn btn-default" type="submit" | ||
onclick="return confirm('Are you sure you want to delete this session?');"> | ||
<span class="glyphicon glyphicon-trash"></span> | ||
</button> | ||
</form> | ||
{% endif %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{% extends "user/setting_layout.html.twig" %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{% extends "layout/base.html.twig" %} | ||
|
||
{% block title %}User setting{% endblock %} | ||
|
||
{% block container %} | ||
<div class="row"> | ||
<div class="col-md-3"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title">Personal settings</h3> | ||
</div> | ||
<div class="panel-body"> | ||
<ul class="nav nav-pills nav-stacked"> | ||
<li><a href="/user/sessions">Sessions</a></li> | ||
</ul> | ||
</div><!--/.panel-body --> | ||
</div> | ||
|
||
</div> | ||
<div class="col-md-9"> | ||
{% block panel %}{% endblock %} | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters