From 9f8a9a3239454c6cdebdba4f49afcad6c57b2cd5 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 6 Jul 2020 16:12:24 +0000 Subject: [PATCH] Heartbeat: Do not disable the login prompts when the user needs to log in again but has closed the log in modal. Add a 5 minutes timeout before asking them to log in again. Props dsixinetu, adamsilverstein, azaozz. Fixes #49573. git-svn-id: https://develop.svn.wordpress.org/trunk@48337 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/lib/auth-check.js | 78 +++++++++++++++++++----------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/src/js/_enqueues/lib/auth-check.js b/src/js/_enqueues/lib/auth-check.js index be2a37cfc0..c5d3af18af 100644 --- a/src/js/_enqueues/lib/auth-check.js +++ b/src/js/_enqueues/lib/auth-check.js @@ -5,8 +5,10 @@ */ /* global adminpage */ -(function($){ - var wrap; +( function( $ ) { + var wrap, + tempHidden, + tempHiddenTimeout; /** * Shows the authentication form popup. @@ -15,18 +17,18 @@ * @private */ function show() { - var parent = $('#wp-auth-check'), - form = $('#wp-auth-check-form'), - noframe = wrap.find('.wp-auth-fallback-expired'), + var parent = $( '#wp-auth-check' ), + form = $( '#wp-auth-check-form' ), + noframe = wrap.find( '.wp-auth-fallback-expired' ), frame, loaded = false; if ( form.length ) { // Add unload confirmation to counter (frame-busting) JS redirects. - $(window).on( 'beforeunload.wp-auth-check', function(e) { - e.originalEvent.returnValue = wp.i18n.__( 'Your session has expired. You can log in again from this page or go to the login page.' ); + $( window ).on( 'beforeunload.wp-auth-check', function( event ) { + event.originalEvent.returnValue = window.wp.i18n.__( 'Your session has expired. You can log in again from this page or go to the login page.' ); }); - frame = $('