Logged out warnings:
- Replace the Close button with an always visible "X" icon in the top/right corner. - Check if the user is still logged in every 3 min. by default. - Add 'wp_auth_check_interval' filter so the interval can be set from PHP. See #23295. git-svn-id: http://core.svn.wordpress.org/trunk@24695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
57a8322792
commit
b96efc779a
|
@ -7187,7 +7187,7 @@ body.interim-login {
|
|||
|
||||
.interim-login #login {
|
||||
padding: 0;
|
||||
margin: 25px auto 20px;
|
||||
margin: 5px auto 20px;
|
||||
}
|
||||
|
||||
.interim-login.login h1 a {
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
overflow: hidden;
|
||||
top: 40px;
|
||||
bottom: 20px;
|
||||
max-height: 435px;
|
||||
max-height: 415px;
|
||||
width: 380px;
|
||||
margin: 0 0 0 -190px;
|
||||
padding: 0;
|
||||
padding: 30px 0 0;
|
||||
background-color: #fbfbfb;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
|
||||
#wp-auth-check-wrap #wp-auth-check-form {
|
||||
background: url('../images/wpspin-2x.gif') no-repeat center center;
|
||||
background: url(../images/wpspin-2x.gif) no-repeat center center;
|
||||
background-size: 16px 16px;
|
||||
height: 100%;
|
||||
}
|
||||
|
@ -52,10 +52,19 @@
|
|||
}
|
||||
|
||||
#wp-auth-check-wrap .wp-auth-check-close {
|
||||
bottom: 10px;
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 30px;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
cursor: pointer;
|
||||
background-image: url(../images/uploader-icons.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: -100px 0;
|
||||
}
|
||||
|
||||
#wp-auth-check-wrap .wp-auth-check-close:focus {
|
||||
outline: 1px dotted #888;
|
||||
}
|
||||
|
||||
#wp-auth-check-wrap .wp-auth-fallback-expired {
|
||||
|
@ -65,7 +74,7 @@
|
|||
#wp-auth-check-wrap .wp-auth-fallback {
|
||||
font-size: 14px;
|
||||
line-height: 21px;
|
||||
padding: 10px 25px;
|
||||
padding: 0 25px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -74,3 +83,12 @@
|
|||
display: block;
|
||||
}
|
||||
|
||||
@media print,
|
||||
(-o-min-device-pixel-ratio: 5/4),
|
||||
(-webkit-min-device-pixel-ratio: 1.25),
|
||||
(min-resolution: 120dpi) {
|
||||
#wp-auth-check-wrap .wp-auth-check-close {
|
||||
background-image: url(../images/uploader-icons-2x.png);
|
||||
background-size: 134px 15px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3943,6 +3943,7 @@ function wp_auth_check_html() {
|
|||
<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
|
||||
<div id="wp-auth-check-bg"></div>
|
||||
<div id="wp-auth-check">
|
||||
<div class="wp-auth-check-close" tabindex="0" title="<?php esc_attr_e('Close'); ?>"></div>
|
||||
<?php
|
||||
|
||||
if ( $same_domain ) {
|
||||
|
@ -3957,7 +3958,6 @@ function wp_auth_check_html() {
|
|||
<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
|
||||
<?php _e('The login page will open in a new window. After logging in you can close it and return to this page.'); ?></p>
|
||||
</div>
|
||||
<p class="wp-auth-check-close"><a href="#" class="button button-primary"><?php _e('Close'); ?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
@ -3974,9 +3974,9 @@ function wp_auth_check( $response, $data ) {
|
|||
|
||||
// If the user is logged in and we are outside the login grace period, bail.
|
||||
if ( is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ) )
|
||||
return $response;
|
||||
return array_merge( $response, array( 'wp-auth-check' => '1' ) );
|
||||
|
||||
return array_merge( $response, array( 'wp-auth-check' => '1' ) );
|
||||
return array_merge( $response, array( 'wp-auth-check' => 'show' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Interim login dialog
|
||||
(function($){
|
||||
var wrap, check, scheduleTimeout;
|
||||
var wrap, check, next;
|
||||
|
||||
function show() {
|
||||
var parent = $('#wp-auth-check'), form = $('#wp-auth-check-form'), noframe = wrap.find('.wp-auth-fallback-expired'), frame, loaded = false;
|
||||
|
@ -32,7 +32,7 @@
|
|||
if ( body && body.hasClass('interim-login-success') )
|
||||
hide();
|
||||
else
|
||||
parent.css( 'max-height', height + 60 + 'px' );
|
||||
parent.css( 'max-height', height + 40 + 'px' );
|
||||
} else if ( ! body || ! body.length ) {
|
||||
// Catch "silent" iframe origin exceptions in WebKit after another page is loaded in the iframe
|
||||
wrap.addClass('fallback');
|
||||
|
@ -74,49 +74,34 @@
|
|||
}
|
||||
|
||||
wrap.fadeOut( 200, function() {
|
||||
wrap.addClass('hidden').css('display', '').find('.wp-auth-check-close').css('display', '');
|
||||
wrap.addClass('hidden').css('display', '');
|
||||
$('#wp-auth-check-frame').remove();
|
||||
});
|
||||
}
|
||||
|
||||
function schedule() {
|
||||
check = false;
|
||||
window.clearTimeout( scheduleTimeout );
|
||||
scheduleTimeout = window.setTimeout( function(){ check = 1; }, 300000 ); // 5 min.
|
||||
var interval = parseInt( window.authcheckL10n.interval, 10 ) || 180; // in seconds, default 3 min.
|
||||
next = ( new Date() ).getTime() + ( interval * 1000 );
|
||||
}
|
||||
|
||||
$( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
|
||||
if ( check === 2 )
|
||||
if ( data['wp-auth-check'] ) {
|
||||
schedule();
|
||||
|
||||
if ( data['wp-auth-check'] && wrap.hasClass('hidden') ) {
|
||||
show();
|
||||
} else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') ) {
|
||||
hide();
|
||||
if ( data['wp-auth-check'] == 'show' && wrap.hasClass('hidden') )
|
||||
show();
|
||||
else if ( data['wp-auth-check'] != 'show' && ! wrap.hasClass('hidden') )
|
||||
hide();
|
||||
}
|
||||
}).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
|
||||
if ( ( new Date() ).getTime() > next )
|
||||
data['wp-auth-check'] = 1;
|
||||
}).ready( function() {
|
||||
schedule();
|
||||
wrap = $('#wp-auth-check-wrap');
|
||||
wrap.find('.wp-auth-check-close').on( 'click', function(e) {
|
||||
hide();
|
||||
});
|
||||
// Bind later
|
||||
$( document ).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
|
||||
var i, empty = true;
|
||||
// Check if something is using heartbeat. If yes, trigger the logged out check too.
|
||||
for ( i in data ) {
|
||||
if ( data.hasOwnProperty( i ) ) {
|
||||
empty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( check || ! empty )
|
||||
data['wp-auth-check'] = 1;
|
||||
|
||||
if ( check )
|
||||
check = 2;
|
||||
});
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
|
|
@ -113,6 +113,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 );
|
||||
did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array(
|
||||
'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
|
||||
'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
|
||||
) );
|
||||
|
||||
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
|
||||
|
|
Loading…
Reference in New Issue