mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-06-15 12:36:05 +00:00
Initial commit
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Travis Horn
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
42
app/static/global/plugins/bootstrap-sessiontimeout/README.md
Normal file
42
app/static/global/plugins/bootstrap-sessiontimeout/README.md
Normal file
@ -0,0 +1,42 @@
|
||||
# sessionTimeout
|
||||
|
||||
Derived from jquery-sessionTimeout
|
||||
|
||||
See https://github.com/travishorn/jquery-sessionTimeout for more info.
|
||||
|
||||
|
||||
## Description
|
||||
After a set amount of time, a dialog is shown to the user with the option to either log out now, or stay connected. If log out now is selected, the page is redirected to a logout URL. If stay connected is selected, a keep-alive URL is requested through AJAX. If no options is selected after another set amount of time, the page is automatically redirected to a timeout URL.
|
||||
|
||||
This version uses modals provided by Twitter Bootstrap 3.
|
||||
|
||||
## Usage
|
||||
1. Include jQuery
|
||||
2. Include bootstrap.js (for dialog)
|
||||
3. Include jquery.sessionTimeout.js
|
||||
4. Call `$.sessionTimeout();` after document ready
|
||||
|
||||
## Options
|
||||
**message**<br>
|
||||
Text shown to user in dialog after warning period.
|
||||
Default: 'Your session is about to expire.'
|
||||
|
||||
**keepAliveUrl**<br>
|
||||
URL to call through AJAX to keep session alive. This resource should do something innocuous that would keep the session alive, which will depend on your server-side platform.<br>
|
||||
Default: '/keep-alive'
|
||||
|
||||
**redirUrl**<br>
|
||||
URL to take browser to if no action is take after warning period.<br>
|
||||
Default: '/timed-out'
|
||||
|
||||
**logoutUrl**<br>
|
||||
URL to take browser to if user clicks "Logout".<br>
|
||||
Default: '/log-out'
|
||||
|
||||
**warnAfter**<br>
|
||||
Time in milliseconds after page is opened until warning dialog is opened.<br>
|
||||
Default: 900000 (15 minutes)
|
||||
|
||||
**redirAfter**<br>
|
||||
Time in milliseconds after page is opened until browser is redirected to redirUrl.<br>
|
||||
Default: 1200000 (20 minutes)
|
@ -0,0 +1,115 @@
|
||||
/*jshint browser:true*/
|
||||
|
||||
//
|
||||
// jquery.sessionTimeout.js
|
||||
//
|
||||
// After a set amount of time, a dialog is shown to the user with the option
|
||||
// to either log out now, or stay connected. If log out now is selected,
|
||||
// the page is redirected to a logout URL. If stay connected is selected,
|
||||
// a keep-alive URL is requested through AJAX. If no options is selected
|
||||
// after another set amount of time, the page is automatically redirected
|
||||
// to a timeout URL.
|
||||
//
|
||||
//
|
||||
// USAGE
|
||||
//
|
||||
// 1. Include jQuery
|
||||
// 2. Include jQuery UI (for dialog)
|
||||
// 3. Include jquery.sessionTimeout.js
|
||||
// 4. Call $.sessionTimeout(); after document ready
|
||||
//
|
||||
//
|
||||
// OPTIONS
|
||||
//
|
||||
// message
|
||||
// Text shown to user in dialog after warning period.
|
||||
// Default: 'Your session is about to expire.'
|
||||
//
|
||||
// keepAliveUrl
|
||||
// URL to call through AJAX to keep session alive. This resource should do something innocuous that would keep the session alive, which will depend on your server-side platform.
|
||||
// Default: '/keep-alive'
|
||||
//
|
||||
// redirUrl
|
||||
// URL to take browser to if no action is take after warning period
|
||||
// Default: '/timed-out'
|
||||
//
|
||||
// logoutUrl
|
||||
// URL to take browser to if user clicks "Log Out Now"
|
||||
// Default: '/log-out'
|
||||
//
|
||||
// warnAfter
|
||||
// Time in milliseconds after page is opened until warning dialog is opened
|
||||
// Default: 900000 (15 minutes)
|
||||
//
|
||||
// redirAfter
|
||||
// Time in milliseconds after page is opened until browser is redirected to redirUrl
|
||||
// Default: 1200000 (20 minutes)
|
||||
//
|
||||
(function( $ ){
|
||||
jQuery.sessionTimeout = function( options ) {
|
||||
var defaults = {
|
||||
title : 'Session Notification',
|
||||
message : 'Your session is about to expire.',
|
||||
keepAliveUrl : '/keep-alive',
|
||||
redirUrl : '/timed-out',
|
||||
logoutUrl : '/log-out',
|
||||
warnAfter : 900000, // 15 minutes
|
||||
redirAfter : 1200000 // 20 minutes
|
||||
};
|
||||
|
||||
// Extend user-set options over defaults
|
||||
var o = defaults,
|
||||
dialogTimer,
|
||||
redirTimer;
|
||||
|
||||
if ( options ) { o = $.extend( defaults, options ); }
|
||||
|
||||
// Create timeout warning dialog
|
||||
$('body').append('<div class="modal fade" id="sessionTimeout-dialog"><div class="modal-dialog modal-small"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4 class="modal-title">'+ o.title +'</h4></div><div class="modal-body">'+ o.message +'</div><div class="modal-footer"><button id="sessionTimeout-dialog-logout" type="button" class="btn btn-default">Logout</button><button id="sessionTimeout-dialog-keepalive" type="button" class="btn btn-primary" data-dismiss="modal">Stay Connected</button></div></div></div></div>');
|
||||
$('#sessionTimeout-dialog-logout').on('click', function () { window.location = o.logoutUrl; });
|
||||
$('#sessionTimeout-dialog').on('hide.bs.modal', function () {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: o.keepAliveUrl
|
||||
});
|
||||
|
||||
// Stop redirect timer and restart warning timer
|
||||
controlRedirTimer('stop');
|
||||
controlDialogTimer('start');
|
||||
})
|
||||
|
||||
function controlDialogTimer(action){
|
||||
switch(action) {
|
||||
case 'start':
|
||||
// After warning period, show dialog and start redirect timer
|
||||
dialogTimer = setTimeout(function(){
|
||||
$('#sessionTimeout-dialog').modal('show');
|
||||
controlRedirTimer('start');
|
||||
}, o.warnAfter);
|
||||
break;
|
||||
|
||||
case 'stop':
|
||||
clearTimeout(dialogTimer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function controlRedirTimer(action){
|
||||
switch(action) {
|
||||
case 'start':
|
||||
// Dialog has been shown, if no action taken during redir period, redirect
|
||||
redirTimer = setTimeout(function(){
|
||||
window.location = o.redirUrl;
|
||||
}, o.redirAfter - o.warnAfter);
|
||||
break;
|
||||
|
||||
case 'stop':
|
||||
clearTimeout(redirTimer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Begin warning period
|
||||
controlDialogTimer('start');
|
||||
};
|
||||
})( jQuery );
|
1
app/static/global/plugins/bootstrap-sessiontimeout/jquery.sessionTimeout.min.js
vendored
Normal file
1
app/static/global/plugins/bootstrap-sessiontimeout/jquery.sessionTimeout.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e){jQuery.sessionTimeout=function(t){function i(t){switch(t){case"start":s=setTimeout(function(){e("#sessionTimeout-dialog").modal("show"),n("start")},r.warnAfter);break;case"stop":clearTimeout(s)}}function n(e){switch(e){case"start":o=setTimeout(function(){window.location=r.redirUrl},r.redirAfter-r.warnAfter);break;case"stop":clearTimeout(o)}}var s,o,a={title:"Session Notification",message:"Your session is about to expire.",keepAliveUrl:"/keep-alive",redirUrl:"/timed-out",logoutUrl:"/log-out",warnAfter:9e5,redirAfter:12e5},r=a;t&&(r=e.extend(a,t)),e("body").append('<div class="modal fade" id="sessionTimeout-dialog"><div class="modal-dialog modal-small"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4 class="modal-title">'+r.title+'</h4></div><div class="modal-body">'+r.message+'</div><div class="modal-footer"><button id="sessionTimeout-dialog-logout" type="button" class="btn btn-default">Logout</button><button id="sessionTimeout-dialog-keepalive" type="button" class="btn btn-primary" data-dismiss="modal">Stay Connected</button></div></div></div></div>'),e("#sessionTimeout-dialog-logout").on("click",function(){window.location=r.logoutUrl}),e("#sessionTimeout-dialog").on("hide.bs.modal",function(){e.ajax({type:"POST",url:r.keepAliveUrl}),n("stop"),i("start")}),i("start")}}(jQuery);
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "sessiontimeout-bootstrap",
|
||||
"version": "1.0.3",
|
||||
"description": "After a set amount of time, a dialog is shown to the user with the option to either log out now, or stay connected. If log out now is selected, the page is redirected to a logout URL. If stay connected is selected, a keep-alive URL is requested through AJAX. If no options is selected after another set amount of time, the page is automatically redirected to a timeout URL. This fork uses Bootstrap's modal instead of upstream's jQuery UI modal.",
|
||||
"main": "jquery.sessionTimeout.js",
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/maxfierke/jquery-sessionTimeout-bootstrap.git"
|
||||
},
|
||||
"keywords": [
|
||||
"alert",
|
||||
"ajax",
|
||||
"bootstrap"
|
||||
],
|
||||
"author": "Travis Horn",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Max Fierke",
|
||||
"email": "max@maxfierke.com",
|
||||
"url": "http://www.maxfierke.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/maxfierke/jquery-sessionTimeout-bootstrap/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-contrib-jshint": "~0.6.0",
|
||||
"grunt-contrib-uglify": "~0.2.2"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user