Skip to content

Commit

Permalink
Add extend here
Browse files Browse the repository at this point in the history
Post OpenUserJS#1446 ... related to OpenUserJS#604
  • Loading branch information
Martii committed Jul 7, 2018
1 parent b6220e9 commit 14e8e46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ exports.adminSessionActiveView = function (aReq, aRes, aNext) {
: oujsOptions.authFrom
? oujsOptions.authFrom
: null;

session.showExtend = aReq.sessionID === oujsOptions.sid;
session.canExtend = !oujsOptions.extended;

return session;
});

Expand Down
9 changes: 9 additions & 0 deletions views/includes/session.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
Expires {{#cookie.expires}}<time datetime="{{cookie.expiresISOFormat}}" title="{{cookie.expires}}">{{cookie.expiresHumanized}}</time>{{/cookie.expires}}{{^cookie.expires}}&and;{{/cookie.expires}}.
</div>
<div class="pull-right">
{{#showExtend}}
<form class="form-inline" action="/api/user/session/extend" method="post">
<div class="input-group">
<button class="btn btn-success" type="submit"{{^canExtend}}disabled="disabled"{{/canExtend}}><i class="fa fa-fw fa-history"></i> Extend</button>
</div>
</form>
{{/showExtend}}
{{^showExtend}}
<form class="form-inline" action="/api/user/session/destroyOne" method="post">
<div class="input-group">
<input type="hidden" name="username" value="{{name}}">
Expand All @@ -51,6 +59,7 @@
</button>
</div>
</form>
{{/showExtend}}
</div>
</div>
</div>
Expand Down

0 comments on commit 14e8e46

Please sign in to comment.