提交 | 用户 | 时间
|
58d006
|
1 |
# sessionTimeout |
A |
2 |
|
|
3 |
Derived from jquery-sessionTimeout |
|
4 |
|
|
5 |
See https://github.com/travishorn/jquery-sessionTimeout for more info. |
|
6 |
|
|
7 |
|
|
8 |
## Description |
|
9 |
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. |
|
10 |
|
|
11 |
This version uses modals provided by Twitter Bootstrap 3. |
|
12 |
|
|
13 |
## Usage |
|
14 |
1. Include jQuery |
|
15 |
2. Include bootstrap.js (for dialog) |
|
16 |
3. Include jquery.sessionTimeout.js |
|
17 |
4. Call `$.sessionTimeout();` after document ready |
|
18 |
|
|
19 |
## Options |
|
20 |
**message**<br> |
|
21 |
Text shown to user in dialog after warning period. |
|
22 |
Default: 'Your session is about to expire.' |
|
23 |
|
|
24 |
**keepAliveUrl**<br> |
|
25 |
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> |
|
26 |
Default: '/keep-alive' |
|
27 |
|
|
28 |
**redirUrl**<br> |
|
29 |
URL to take browser to if no action is take after warning period.<br> |
|
30 |
Default: '/timed-out' |
|
31 |
|
|
32 |
**logoutUrl**<br> |
|
33 |
URL to take browser to if user clicks "Logout".<br> |
|
34 |
Default: '/log-out' |
|
35 |
|
|
36 |
**warnAfter**<br> |
|
37 |
Time in milliseconds after page is opened until warning dialog is opened.<br> |
|
38 |
Default: 900000 (15 minutes) |
|
39 |
|
|
40 |
**redirAfter**<br> |
|
41 |
Time in milliseconds after page is opened until browser is redirected to redirUrl.<br> |
|
42 |
Default: 1200000 (20 minutes) |