PluginProbe
Authorizer / 3.8.3
Authorizer v3.8.3
3.16.0 3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 All 127 releases
← All changes | js/authorizer.js +243 -148 2.8.63.8.3 View file →
@@ -19,9 +19,9 @@
19 19 function refreshApprovedUserList( currentPage, searchTerm ) {
20 20 var $list = $( '#list_auth_settings_access_users_approved' );
21 21 var $spinner = $( '<span class="spinner is-active"></span>' ).css({
22 22 position: 'relative',
23 - top: '45%',
23 + top: '40%',
24 24 left: '-240px',
25 25 });
26 26 var $overlay = $( '<div id="list_auth_settings_access_users_approved_overlay"></div>' ).css({
27 27 'background-color': '#f1f1f1',
@@ -27,9 +27,9 @@
27 27 'background-color': '#f1f1f1',
28 28 'z-index': 1,
29 29 opacity: 0.8,
30 30 position: 'absolute',
31 - top: $list.position().top,
31 + top: $list.position().top + parseInt( $list.css( 'margin-top' ) ),
32 32 left: $list.position().left,
33 33 width: $list.width(),
34 34 height: $list.height(),
35 35 });
@@ -102,35 +102,35 @@
102 102
103 103 // Update first page button.
104 104 var $first = $( '.first-page' );
105 105 if ( $first.is( 'a' ) && currentPage <= 1 ) {
106 - $first.replaceWith( '<span class="first-page tablenav-pages-navspan" aria-hidden="true">&laquo;</span>' );
106 + $first.replaceWith( '<span class="button disabled first-page tablenav-pages-navspan" aria-hidden="true">&laquo;</span>' );
107 107 } else if ( $first.is( 'span' ) && currentPage > 1 ) {
108 - $first.replaceWith( '<a class="first-page" href="' + updateQueryStringParameter( window.location.href, 'paged', '1' ) + '"><span class="screen-reader-text">' + authL10n.first_page + '</span><span aria-hidden="true">&laquo;</span></a>' );
108 + $first.replaceWith( '<a class="button first-page" href="' + updateQueryStringParameter( window.location.href, 'paged', '1' ) + '"><span class="screen-reader-text">' + authL10n.first_page + '</span><span aria-hidden="true">&laquo;</span></a>' );
109 109 }
110 110
111 111 // Update prev page button.
112 112 var $prev = $( '.prev-page' );
113 113 if ( $prev.is( 'a' ) && currentPage <= 1 ) {
114 - $prev.replaceWith( '<span class="prev-page tablenav-pages-navspan" aria-hidden="true">&lsaquo;</span>' );
114 + $prev.replaceWith( '<span class="button disabled prev-page tablenav-pages-navspan" aria-hidden="true">&lsaquo;</span>' );
115 115 } else if ( currentPage > 1 ) {
116 - $prev.replaceWith( '<a class="prev-page" href="' + updateQueryStringParameter( window.location.href, 'paged', currentPage - 1 ) + '"><span class="screen-reader-text">' + authL10n.prev_page + '</span><span aria-hidden="true">&lsaquo;</span></a>' );
116 + $prev.replaceWith( '<a class="button prev-page" href="' + updateQueryStringParameter( window.location.href, 'paged', currentPage - 1 ) + '"><span class="screen-reader-text">' + authL10n.prev_page + '</span><span aria-hidden="true">&lsaquo;</span></a>' );
117 117 }
118 118
119 119 // Update next button.
120 120 var $next = $( '.next-page' );
121 121 if ( $next.is( 'a' ) && currentPage >= totalPages ) {
122 - $next.replaceWith( '<span class="next-page tablenav-pages-navspan" aria-hidden="true">&rsaquo;</span>' );
122 + $next.replaceWith( '<span class="button disabled next-page tablenav-pages-navspan" aria-hidden="true">&rsaquo;</span>' );
123 123 } else if ( currentPage < totalPages ) {
124 - $next.replaceWith( '<a class="next-page" href="' + updateQueryStringParameter( window.location.href, 'paged', currentPage + 1 ) + '"><span class="screen-reader-text">' + authL10n.next_page + '</span><span aria-hidden="true">&rsaquo;</span></a>' );
124 + $next.replaceWith( '<a class="button next-page" href="' + updateQueryStringParameter( window.location.href, 'paged', currentPage + 1 ) + '"><span class="screen-reader-text">' + authL10n.next_page + '</span><span aria-hidden="true">&rsaquo;</span></a>' );
125 125 }
126 126
127 127 // Update last button.
128 128 var $last = $( '.last-page' );
129 129 if ( $last.is( 'a' ) && currentPage >= totalPages ) {
130 - $last.replaceWith( '<span class="last-page tablenav-pages-navspan" aria-hidden="true">&raquo;</span>' );
130 + $last.replaceWith( '<span class="button disabled last-page tablenav-pages-navspan" aria-hidden="true">&raquo;</span>' );
131 131 } else if ( $last.is( 'span' ) && currentPage < totalPages ) {
132 - $last.replaceWith( '<a class="last-page" href="' + updateQueryStringParameter( window.location.href, 'paged', totalPages ) + '"><span class="screen-reader-text">' + authL10n.next_page + '</span><span aria-hidden="true">&raquo;</span></a>' );
132 + $last.replaceWith( '<a class="button last-page" href="' + updateQueryStringParameter( window.location.href, 'paged', totalPages ) + '"><span class="screen-reader-text">' + authL10n.next_page + '</span><span aria-hidden="true">&raquo;</span></a>' );
133 133 }
134 134 }
135 135
136 136 // Make changes to one of the user lists (pending, approved, blocked) via ajax.
@@ -198,9 +198,9 @@
198 198 nonce: nonce,
199 199 }, function( response ) {
200 200 // Server responded, but if success isn't true it failed to save.
201 201 var succeeded = response.success;
202 - var spinnerText = succeeded ? authL10n.saved + '.' : '<span style="color: red;">' + authL10n.failed + '.</span>';
202 + var spinnerText = succeeded ? authL10n.saved + '.' : '<span class="attention">' + authL10n.failed + '.</span>';
203 203 var spinnerWait = succeeded ? 500 : 2000;
204 204
205 205 // Remove any new user entries that were rejected by the server.
206 206 if ( response.invalid_emails.length > 0 ) {
@@ -206,9 +206,9 @@
206 206 if ( response.invalid_emails.length > 0 ) {
207 207 for ( var i = 0; i < response.invalid_emails.length; i++ ) {
208 208 var duplicateEmail = response.invalid_emails[i];
209 209 $( 'li.new-user .auth-email[value="' + duplicateEmail + '"]' )
210 - .siblings( '.spinner' ).addClass( 'duplicate' ).append( '<span class="spinner-text" style="color: red;">' + authL10n.duplicate + '.</span>' )
210 + .siblings( '.spinner' ).addClass( 'duplicate' ).append( '<span class="spinner-text"><span class="attention">' + authL10n.duplicate + '.</span></span>' )
211 211 .parent().fadeOut( spinnerWait, function() { $( this ).remove(); }); // jshint ignore:line
212 212 }
213 213 }
214 214
@@ -222,9 +222,9 @@
222 222 $( 'html' ).removeClass( 'busy' );
223 223 }).fail( function() {
224 224 // Fail fires if the server doesn't respond or responds with 500 codes
225 225 var succeeded = false;
226 - var spinnerText = succeeded ? authL10n.saved + '.' : '<span style="color: red;">' + authL10n.failed + '.</span>';
226 + var spinnerText = succeeded ? authL10n.saved + '.' : '<span class="attention">' + authL10n.failed + '.</span>';
227 227 var spinnerWait = succeeded ? 500 : 2000;
228 228 $( 'form .spinner:not(:has(.spinner-text))' ).append( '<span class="spinner-text">' + spinnerText + '</span>' ).delay( spinnerWait ).hide( animationSpeed, function() {
229 229 $( this ).remove();
230 230 });
@@ -253,12 +253,11 @@
253 253 'z-index': 1,
254 254 opacity: 0.8,
255 255 position: 'absolute',
256 256 top: settings.position().top,
257 - left: settings.position().left - 20,
258 - width: '100%',
259 - height: settings.height(),
260 - 'padding-left': 20,
257 + left: settings.position().left,
258 + width: settings.width(),
259 + height: settings.height() + 50,
261 260 });
262 261 overlay.show();
263 262 }
264 263 }
@@ -274,16 +273,15 @@
274 273 // Helper function to hide/show wordpress option
275 274 function animateOption( action, option ) {
276 275 if ( action === 'show' ) {
277 276 $( 'div.animated_wrapper', option ).slideDown( animationSpeed );
278 - $( 'th', option ).animate({ padding: '20px 10px 20px 0' }, { duration: animationSpeed });
279 - $( 'td', option ).animate({ padding: '15px 10px' }, { duration: animationSpeed });
277 + $( 'th, td', option ).removeClass( 'hide-animate hide-no-animate' );
280 278 } else if ( action === 'hide' ) {
281 279 $( 'div.animated_wrapper', option ).slideUp( animationSpeed );
282 - $( 'td, th', option ).animate({ padding: '0px' }, { duration: animationSpeed });
280 + $( 'td, th', option ).addClass( 'hide-animate' );
283 281 } else if ( action === 'hide_immediately' ) {
284 282 $( 'div.animated_wrapper', option ).hide();
285 - $( 'td, th', option ).css({ padding: '0px' });
283 + $( 'td, th', option ).addClass( 'hide-no-animate' );
286 284 }
287 285 }
288 286
289 287 // Helper function to grab a querystring param value by name
@@ -384,24 +382,37 @@
384 382 var auth_settings_access_public_pages = $( '#auth_settings_access_public_pages' ).closest( 'tr' );
385 383 var auth_settings_access_redirect_to_login = $( '#radio_auth_settings_access_redirect_to_login' ).closest( 'tr' );
386 384 var auth_settings_access_public_warning = $( '#radio_auth_settings_access_public_warning' ).closest( 'tr' );
387 385 var auth_settings_access_redirect_to_message = $( '#wp-auth_settings_access_redirect_to_message-wrap' ).closest( 'tr' );
386 + var auth_settings_external_oauth2_provider = $( '#auth_settings_oauth2_provider' ).closest( 'tr' );
387 + var auth_settings_external_oauth2_custom_label = $( '#auth_settings_oauth2_custom_label' ).closest( 'tr' );
388 + var auth_settings_external_oauth2_clientid = $( '#auth_settings_oauth2_clientid' ).closest( 'tr' );
389 + var auth_settings_external_oauth2_clientsecret = $( '#auth_settings_oauth2_clientsecret' ).closest( 'tr' );
390 + var auth_settings_external_oauth2_hosteddomain = $( '#auth_settings_oauth2_hosteddomain' ).closest( 'tr' );
391 + var auth_settings_external_oauth2_tenant_id = $( '#auth_settings_oauth2_tenant_id' ).closest( 'tr' );
392 + var auth_settings_external_oauth2_url_authorize = $( '#auth_settings_oauth2_url_authorize' ).closest( 'tr' );
393 + var auth_settings_external_oauth2_url_token = $( '#auth_settings_oauth2_url_token' ).closest( 'tr' );
394 + var auth_settings_external_oauth2_url_resource = $( '#auth_settings_oauth2_url_resource' ).closest( 'tr' );
395 + var auth_settings_external_oauth2_auto_login = $( '#auth_settings_oauth2_auto_login' ).closest( 'tr' );
388 396 var auth_settings_external_google_clientid = $( '#auth_settings_google_clientid' ).closest( 'tr' );
389 397 var auth_settings_external_google_clientsecret = $( '#auth_settings_google_clientsecret' ).closest( 'tr' );
390 398 var auth_settings_external_google_hosteddomain = $( '#auth_settings_google_hosteddomain' ).closest( 'tr' );
399 + var auth_settings_external_cas_auto_login = $( '#auth_settings_cas_auto_login' ).closest( 'tr' );
391 400 var auth_settings_external_cas_custom_label = $( '#auth_settings_cas_custom_label' ).closest( 'tr' );
392 401 var auth_settings_external_cas_host = $( '#auth_settings_cas_host' ).closest( 'tr' );
393 402 var auth_settings_external_cas_port = $( '#auth_settings_cas_port' ).closest( 'tr' );
394 403 var auth_settings_external_cas_path = $( '#auth_settings_cas_path' ).closest( 'tr' );
404 + var auth_settings_external_cas_method = $( '#auth_settings_cas_method' ).closest( 'tr' );
395 405 var auth_settings_external_cas_version = $( '#auth_settings_cas_version' ).closest( 'tr' );
396 406 var auth_settings_external_cas_attr_email = $( '#auth_settings_cas_attr_email' ).closest( 'tr' );
397 407 var auth_settings_external_cas_attr_first_name = $( '#auth_settings_cas_attr_first_name' ).closest( 'tr' );
398 408 var auth_settings_external_cas_attr_last_name = $( '#auth_settings_cas_attr_last_name' ).closest( 'tr' );
399 409 var auth_settings_external_cas_attr_update_on_login = $( '#auth_settings_cas_attr_update_on_login' ).closest( 'tr' );
400 - var auth_settings_external_cas_auto_login = $( '#auth_settings_cas_auto_login' ).closest( 'tr' );
410 + var auth_settings_external_cas_link_on_username = $( '#auth_settings_cas_link_on_username' ).closest( 'tr' );
401 411 var auth_settings_external_ldap_host = $( '#auth_settings_ldap_host' ).closest( 'tr' );
402 412 var auth_settings_external_ldap_port = $( '#auth_settings_ldap_port' ).closest( 'tr' );
403 413 var auth_settings_external_ldap_search_base = $( '#auth_settings_ldap_search_base' ).closest( 'tr' );
414 + var auth_settings_external_ldap_search_filter = $( '#auth_settings_ldap_search_filter' ).closest( 'tr' );
404 415 var auth_settings_external_ldap_uid = $( '#auth_settings_ldap_uid' ).closest( 'tr' );
405 416 var auth_settings_external_ldap_attr_email = $( '#auth_settings_ldap_attr_email' ).closest( 'tr' );
406 417 var auth_settings_external_ldap_user = $( '#auth_settings_ldap_user' ).closest( 'tr' );
407 418 var auth_settings_external_ldap_password = $( '#auth_settings_ldap_password' ).closest( 'tr' );
@@ -409,8 +420,9 @@
409 420 var auth_settings_external_ldap_lostpassword_url = $( '#auth_settings_ldap_lostpassword_url' ).closest( 'tr' );
410 421 var auth_settings_external_ldap_attr_first_name = $( '#auth_settings_ldap_attr_first_name' ).closest( 'tr' );
411 422 var auth_settings_external_ldap_attr_last_name = $( '#auth_settings_ldap_attr_last_name' ).closest( 'tr' );
412 423 var auth_settings_external_ldap_attr_update_on_login = $( '#auth_settings_ldap_attr_update_on_login' ).closest( 'tr' );
424 + var auth_settings_external_ldap_test_user = $( '#auth_settings_ldap_test_user' ).closest( 'tr' );
413 425 /* eslint-enable */
414 426
415 427 // Wrap the th and td in the rows above so we can animate their heights (can't animate tr heights with jquery)
416 428 $( 'th, td', auth_settings_access_role_receive_pending_emails ).wrapInner( '<div class="animated_wrapper" />' );
@@ -422,24 +434,37 @@
422 434 $( 'th, td', auth_settings_access_public_pages ).wrapInner( '<div class="animated_wrapper" />' );
423 435 $( 'th, td', auth_settings_access_redirect_to_login ).wrapInner( '<div class="animated_wrapper" />' );
424 436 $( 'th, td', auth_settings_access_public_warning ).wrapInner( '<div class="animated_wrapper" />' );
425 437 $( 'th, td', auth_settings_access_redirect_to_message ).wrapInner( '<div class="animated_wrapper" />' );
438 + $( 'th, td', auth_settings_external_oauth2_provider ).wrapInner( '<div class="animated_wrapper" />' );
439 + $( 'th, td', auth_settings_external_oauth2_custom_label ).wrapInner( '<div class="animated_wrapper" />' );
440 + $( 'th, td', auth_settings_external_oauth2_clientid ).wrapInner( '<div class="animated_wrapper" />' );
441 + $( 'th, td', auth_settings_external_oauth2_clientsecret ).wrapInner( '<div class="animated_wrapper" />' );
442 + $( 'th, td', auth_settings_external_oauth2_hosteddomain ).wrapInner( '<div class="animated_wrapper" />' );
443 + $( 'th, td', auth_settings_external_oauth2_tenant_id ).wrapInner( '<div class="animated_wrapper" />' );
444 + $( 'th, td', auth_settings_external_oauth2_url_authorize ).wrapInner( '<div class="animated_wrapper" />' );
445 + $( 'th, td', auth_settings_external_oauth2_url_token ).wrapInner( '<div class="animated_wrapper" />' );
446 + $( 'th, td', auth_settings_external_oauth2_url_resource ).wrapInner( '<div class="animated_wrapper" />' );
447 + $( 'th, td', auth_settings_external_oauth2_auto_login ).wrapInner( '<div class="animated_wrapper" />' );
426 448 $( 'th, td', auth_settings_external_google_clientid ).wrapInner( '<div class="animated_wrapper" />' );
427 449 $( 'th, td', auth_settings_external_google_clientsecret ).wrapInner( '<div class="animated_wrapper" />' );
428 450 $( 'th, td', auth_settings_external_google_hosteddomain ).wrapInner( '<div class="animated_wrapper" />' );
451 + $( 'th, td', auth_settings_external_cas_auto_login ).wrapInner( '<div class="animated_wrapper" />' );
429 452 $( 'th, td', auth_settings_external_cas_custom_label ).wrapInner( '<div class="animated_wrapper" />' );
430 453 $( 'th, td', auth_settings_external_cas_host ).wrapInner( '<div class="animated_wrapper" />' );
431 454 $( 'th, td', auth_settings_external_cas_port ).wrapInner( '<div class="animated_wrapper" />' );
432 455 $( 'th, td', auth_settings_external_cas_path ).wrapInner( '<div class="animated_wrapper" />' );
456 + $( 'th, td', auth_settings_external_cas_method ).wrapInner( '<div class="animated_wrapper" />' );
433 457 $( 'th, td', auth_settings_external_cas_version ).wrapInner( '<div class="animated_wrapper" />' );
434 458 $( 'th, td', auth_settings_external_cas_attr_email ).wrapInner( '<div class="animated_wrapper" />' );
435 459 $( 'th, td', auth_settings_external_cas_attr_first_name ).wrapInner( '<div class="animated_wrapper" />' );
436 460 $( 'th, td', auth_settings_external_cas_attr_last_name ).wrapInner( '<div class="animated_wrapper" />' );
437 461 $( 'th, td', auth_settings_external_cas_attr_update_on_login ).wrapInner( '<div class="animated_wrapper" />' );
438 - $( 'th, td', auth_settings_external_cas_auto_login ).wrapInner( '<div class="animated_wrapper" />' );
462 + $( 'th, td', auth_settings_external_cas_link_on_username ).wrapInner( '<div class="animated_wrapper" />' );
439 463 $( 'th, td', auth_settings_external_ldap_host ).wrapInner( '<div class="animated_wrapper" />' );
440 464 $( 'th, td', auth_settings_external_ldap_port ).wrapInner( '<div class="animated_wrapper" />' );
441 465 $( 'th, td', auth_settings_external_ldap_search_base ).wrapInner( '<div class="animated_wrapper" />' );
466 + $( 'th, td', auth_settings_external_ldap_search_filter ).wrapInner( '<div class="animated_wrapper" />' );
442 467 $( 'th, td', auth_settings_external_ldap_uid ).wrapInner( '<div class="animated_wrapper" />' );
443 468 $( 'th, td', auth_settings_external_ldap_attr_email ).wrapInner( '<div class="animated_wrapper" />' );
444 469 $( 'th, td', auth_settings_external_ldap_user ).wrapInner( '<div class="animated_wrapper" />' );
445 470 $( 'th, td', auth_settings_external_ldap_password ).wrapInner( '<div class="animated_wrapper" />' );
@@ -447,16 +472,10 @@
447 472 $( 'th, td', auth_settings_external_ldap_lostpassword_url ).wrapInner( '<div class="animated_wrapper" />' );
448 473 $( 'th, td', auth_settings_external_ldap_attr_first_name ).wrapInner( '<div class="animated_wrapper" />' );
449 474 $( 'th, td', auth_settings_external_ldap_attr_last_name ).wrapInner( '<div class="animated_wrapper" />' );
450 475 $( 'th, td', auth_settings_external_ldap_attr_update_on_login ).wrapInner( '<div class="animated_wrapper" />' );
476 + $( 'th, td', auth_settings_external_ldap_test_user ).wrapInner( '<div class="animated_wrapper" />' );
451 477
452 - // If we're viewing the dashboard widget, reset a couple of the relevant
453 - // option variables (since they aren't nested in table rows).
454 - if ( $( '#auth_dashboard_widget' ).length ) {
455 - // Remove the helper link, since there are no tabs on the dashboard widget
456 - $( '#dashboard_link_approved_users' ).contents().unwrap();
457 - }
458 -
459 478 // Hide settings unless "Only approved users" is checked
460 479 if ( ! $( '#radio_auth_settings_access_who_can_login_approved_users' ).is( ':checked' ) ) {
461 480 animateOption( 'hide_immediately', auth_settings_access_role_receive_pending_emails );
462 481 animateOption( 'hide_immediately', auth_settings_access_pending_redirect_to_message );
@@ -477,8 +496,30 @@
477 496 animateOption( 'hide_immediately', auth_settings_access_public_warning );
478 497 animateOption( 'hide_immediately', auth_settings_access_redirect_to_message );
479 498 }
480 499
500 + // Hide OAuth2 options if unchecked.
501 + if ( ! $( '#auth_settings_oauth2' ).is( ':checked' ) ) {
502 + animateOption( 'hide_immediately', auth_settings_external_oauth2_provider );
503 + animateOption( 'hide_immediately', auth_settings_external_oauth2_custom_label );
504 + animateOption( 'hide_immediately', auth_settings_external_oauth2_clientid );
505 + animateOption( 'hide_immediately', auth_settings_external_oauth2_clientsecret );
506 + animateOption( 'hide_immediately', auth_settings_external_oauth2_hosteddomain );
507 + animateOption( 'hide_immediately', auth_settings_external_oauth2_auto_login );
508 + }
509 +
510 + // Hide OAuth2 generic options if generic isn't chosen.
511 + if ( ! $( '#auth_settings_oauth2' ).is( ':checked' ) || 'generic' !== $( '#auth_settings_oauth2_provider' ).val() ) {
512 + animateOption( 'hide_immediately', auth_settings_external_oauth2_url_authorize );
513 + animateOption( 'hide_immediately', auth_settings_external_oauth2_url_token );
514 + animateOption( 'hide_immediately', auth_settings_external_oauth2_url_resource );
515 + }
516 +
517 + // Hide OAuth2 Tenant ID if azure isn't chosen.
518 + if ( ! $( '#auth_settings_oauth2' ).is( ':checked' ) || 'azure' !== $( '#auth_settings_oauth2_provider' ).val() ) {
519 + animateOption( 'hide_immediately', auth_settings_external_oauth2_tenant_id );
520 + }
521 +
481 522 // Hide Google options if unchecked
482 523 if ( ! $( '#auth_settings_google' ).is( ':checked' ) ) {
483 524 animateOption( 'hide_immediately', auth_settings_external_google_clientid );
484 525 animateOption( 'hide_immediately', auth_settings_external_google_clientsecret );
@@ -486,18 +527,20 @@
486 527 }
487 528
488 529 // Hide CAS options if unchecked
489 530 if ( ! $( '#auth_settings_cas' ).is( ':checked' ) ) {
531 + animateOption( 'hide_immediately', auth_settings_external_cas_auto_login );
490 532 animateOption( 'hide_immediately', auth_settings_external_cas_custom_label );
491 533 animateOption( 'hide_immediately', auth_settings_external_cas_host );
492 534 animateOption( 'hide_immediately', auth_settings_external_cas_port );
493 535 animateOption( 'hide_immediately', auth_settings_external_cas_path );
536 + animateOption( 'hide_immediately', auth_settings_external_cas_method );
494 537 animateOption( 'hide_immediately', auth_settings_external_cas_version );
495 538 animateOption( 'hide_immediately', auth_settings_external_cas_attr_email );
496 539 animateOption( 'hide_immediately', auth_settings_external_cas_attr_first_name );
497 540 animateOption( 'hide_immediately', auth_settings_external_cas_attr_last_name );
498 541 animateOption( 'hide_immediately', auth_settings_external_cas_attr_update_on_login );
499 - animateOption( 'hide_immediately', auth_settings_external_cas_auto_login );
542 + animateOption( 'hide_immediately', auth_settings_external_cas_link_on_username );
500 543 }
501 544
502 545 // Hide LDAP options if unchecked
503 546 if ( ! $( '#auth_settings_ldap' ).is( ':checked' ) ) {
@@ -503,8 +546,9 @@
503 546 if ( ! $( '#auth_settings_ldap' ).is( ':checked' ) ) {
504 547 animateOption( 'hide_immediately', auth_settings_external_ldap_host );
505 548 animateOption( 'hide_immediately', auth_settings_external_ldap_port );
506 549 animateOption( 'hide_immediately', auth_settings_external_ldap_search_base );
550 + animateOption( 'hide_immediately', auth_settings_external_ldap_search_filter );
507 551 animateOption( 'hide_immediately', auth_settings_external_ldap_uid );
508 552 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_email );
509 553 animateOption( 'hide_immediately', auth_settings_external_ldap_user );
510 554 animateOption( 'hide_immediately', auth_settings_external_ldap_password );
@@ -512,12 +556,13 @@
512 556 animateOption( 'hide_immediately', auth_settings_external_ldap_lostpassword_url );
513 557 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_first_name );
514 558 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_last_name );
515 559 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_update_on_login );
560 + animateOption( 'hide_immediately', auth_settings_external_ldap_test_user );
516 561 }
517 562
518 563 // Event handler: Hide "Handle unauthorized visitors" option if access is granted to "Everyone"
519 - $( 'input[name="auth_settings[access_who_can_login]"]' ).change( function() {
564 + $( 'input[name="auth_settings[access_who_can_login]"]' ).on( 'change', function() {
520 565 // Hide settings unless "Only approved users" is checked
521 566 var action = $( '#radio_auth_settings_access_who_can_login_approved_users' ).is( ':checked' ) ? 'show' : 'hide';
522 567 animateOption( action, auth_settings_access_role_receive_pending_emails );
523 568 animateOption( action, auth_settings_access_pending_redirect_to_message );
@@ -528,9 +573,9 @@
528 573 animateOption( action, auth_settings_access_email_approved_users_body );
529 574 });
530 575
531 576 // Event handler: Hide Welcome email body/subject options if "Send welcome email" is off.
532 - $( 'input[name="auth_settings[access_should_email_approved_users]"]' ).change( function() {
577 + $( 'input[name="auth_settings[access_should_email_approved_users]"]' ).on( 'change', function() {
533 578 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
534 579 animateOption( action, auth_settings_access_email_approved_users_subject );
535 580 animateOption( action, auth_settings_access_email_approved_users_body );
536 581 });
@@ -535,9 +580,9 @@
535 580 animateOption( action, auth_settings_access_email_approved_users_body );
536 581 });
537 582
538 583 // Event handler: Hide "Handle unauthorized visitors" option if access is granted to "Everyone"
539 - $( 'input[name="auth_settings[access_who_can_view]"]' ).change( function() {
584 + $( 'input[name="auth_settings[access_who_can_view]"]' ).on( 'change', function() {
540 585 var action = $( '#radio_auth_settings_access_who_can_view_everyone' ).is( ':checked' ) ? 'hide' : 'show';
541 586 animateOption( action, auth_settings_access_redirect_to_login );
542 587 animateOption( action, auth_settings_access_redirect_to_message );
543 588 animateOption( action, auth_settings_access_public_pages );
@@ -543,10 +588,31 @@
543 588 animateOption( action, auth_settings_access_public_pages );
544 589 animateOption( action, auth_settings_access_public_warning );
545 590 });
546 591
592 + // Event handler: Show/hide OAuth2 options based on checkbox.
593 + $( 'input[name="auth_settings[oauth2]"]' ).on( 'change', function() {
594 + var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
595 + animateOption( action, auth_settings_external_oauth2_provider );
596 + animateOption( action, auth_settings_external_oauth2_custom_label );
597 + animateOption( action, auth_settings_external_oauth2_clientid );
598 + animateOption( action, auth_settings_external_oauth2_clientsecret );
599 + animateOption( action, auth_settings_external_oauth2_hosteddomain );
600 + animateOption( action, auth_settings_external_oauth2_auto_login );
601 + });
602 +
603 + // Event handler: Show/hide OAuth2 generic options based on provider.
604 + $( 'select[name="auth_settings[oauth2_provider]"]' ).on( 'change', function() {
605 + var action = 'generic' === $( this ).val() ? 'show' : 'hide';
606 + animateOption( action, auth_settings_external_oauth2_url_authorize );
607 + animateOption( action, auth_settings_external_oauth2_url_token );
608 + animateOption( action, auth_settings_external_oauth2_url_resource );
609 + action = 'azure' === $( this ).val() ? 'show' : 'hide';
610 + animateOption( action, auth_settings_external_oauth2_tenant_id );
611 + });
612 +
547 613 // Event handler: Show/hide Google options based on checkbox
548 - $( 'input[name="auth_settings[google]"]' ).change( function() {
614 + $( 'input[name="auth_settings[google]"]' ).on( 'change', function() {
549 615 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
550 616 animateOption( action, auth_settings_external_google_clientid );
551 617 animateOption( action, auth_settings_external_google_clientsecret );
552 618 animateOption( action, auth_settings_external_google_hosteddomain );
@@ -552,28 +618,31 @@
552 618 animateOption( action, auth_settings_external_google_hosteddomain );
553 619 });
554 620
555 621 // Event handler: Show/hide CAS options based on checkbox
556 - $( 'input[name="auth_settings[cas]"]' ).change( function() {
622 + $( 'input[name="auth_settings[cas]"]' ).on( 'change', function() {
557 623 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
624 + animateOption( action, auth_settings_external_cas_auto_login );
558 625 animateOption( action, auth_settings_external_cas_custom_label );
559 626 animateOption( action, auth_settings_external_cas_host );
560 627 animateOption( action, auth_settings_external_cas_port );
561 628 animateOption( action, auth_settings_external_cas_path );
629 + animateOption( action, auth_settings_external_cas_method );
562 630 animateOption( action, auth_settings_external_cas_version );
563 631 animateOption( action, auth_settings_external_cas_attr_email );
564 632 animateOption( action, auth_settings_external_cas_attr_first_name );
565 633 animateOption( action, auth_settings_external_cas_attr_last_name );
566 634 animateOption( action, auth_settings_external_cas_attr_update_on_login );
567 - animateOption( action, auth_settings_external_cas_auto_login );
635 + animateOption( action, auth_settings_external_cas_link_on_username );
568 636 });
569 637
570 638 // Event handler: Show/hide LDAP options based on checkbox
571 - $( 'input[name="auth_settings[ldap]"]' ).change( function() {
639 + $( 'input[name="auth_settings[ldap]"]' ).on( 'change', function() {
572 640 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
573 641 animateOption( action, auth_settings_external_ldap_host );
574 642 animateOption( action, auth_settings_external_ldap_port );
575 643 animateOption( action, auth_settings_external_ldap_search_base );
644 + animateOption( action, auth_settings_external_ldap_search_filter );
576 645 animateOption( action, auth_settings_external_ldap_uid );
577 646 animateOption( action, auth_settings_external_ldap_attr_email );
578 647 animateOption( action, auth_settings_external_ldap_user );
579 648 animateOption( action, auth_settings_external_ldap_password );
@@ -581,10 +650,30 @@
581 650 animateOption( action, auth_settings_external_ldap_lostpassword_url );
582 651 animateOption( action, auth_settings_external_ldap_attr_first_name );
583 652 animateOption( action, auth_settings_external_ldap_attr_last_name );
584 653 animateOption( action, auth_settings_external_ldap_attr_update_on_login );
654 + animateOption( action, auth_settings_external_ldap_test_user );
585 655 });
586 656
657 + // Event handler: Test LDAP settings.
658 + $( '#ldap_test_user_submit' ).on( 'click', function( event ) {
659 + event.preventDefault();
660 + $( 'html' ).addClass( 'busy' );
661 + $( '#ldap_test_user_spinner' ).addClass( 'is-active' );
662 +
663 + $.post( ajaxurl, {
664 + action: 'auth_settings_ldap_test_user',
665 + username: $( 'input[name="auth_settings[ldap_test_user]"]' ).val(),
666 + password: $( 'input#auth_settings_ldap_test_pass' ).val(),
667 + nonce: $( '#nonce_save_auth_settings' ).val(),
668 + }).done( function ( data ) {
669 + $( '#ldap_test_user_result' ).show().val( data.message );
670 + }).always( function () {
671 + $( 'html' ).removeClass( 'busy' );
672 + $( '#ldap_test_user_spinner' ).removeClass( 'is-active' );
673 + });
674 + } );
675 +
587 676 // Show save button if usermeta field is modified.
588 677 $( 'form input.auth-usermeta' ).on( 'keyup', function( event ) {
589 678 // Don't do anything if tab or arrow keys were pressed.
590 679 if ( event.which === 9 || event.which === 37 || event.which === 38 || event.which === 39 || event.which === 40 ) {
@@ -623,22 +712,26 @@
623 712 selectableHeader: '<div class="custom-header">' + authL10n.private_pages + '</div>',
624 713 selectionHeader: '<div class="custom-header">' + authL10n.public_pages + '</div>',
625 714 });
626 715
627 - // Switch to the first tab (or the tab indicated in sessionStorage, or the querystring).
628 - var tab = '';
629 - if ( getQuerystringValuesByKey( 'tab' ).length > 0 ) {
630 - tab = getQuerystringValuesByKey( 'tab' )[0];
631 - } else if ( sessionStorage.getItem( 'tab' ) ) {
632 - tab = sessionStorage.getItem( 'tab' );
716 + // Switch to the first tab (or the tab indicated in sessionStorage, or the
717 + // querystring). Note: only do this on the settings page, not the dashboard
718 + // widget.
719 + if ( ! $( '#auth_dashboard_widget' ).length ) {
720 + var tab = '';
721 + if ( getQuerystringValuesByKey( 'tab' ).length > 0 ) {
722 + tab = getQuerystringValuesByKey( 'tab' )[0];
723 + } else if ( sessionStorage.getItem( 'tab' ) ) {
724 + tab = sessionStorage.getItem( 'tab' );
725 + }
726 + if ( $.inArray( tab, [ 'access_lists', 'access_login', 'access_public', 'external', 'advanced' ] ) < 0 ) {
727 + tab = 'access_lists';
728 + }
729 + window.chooseTab( tab, animationSpeed );
633 730 }
634 - if ( $.inArray( tab, [ 'access_lists', 'access_login', 'access_public', 'external', 'advanced' ] ) < 0 ) {
635 - tab = 'access_lists';
636 - }
637 - window.chooseTab( tab, animationSpeed );
638 731
639 732 // Hide/show multisite settings based on override checkbox.
640 - $( 'input[name="auth_settings[multisite_override]"]' ).change( function() {
733 + $( 'input[name="auth_settings[multisite_override]"]' ).on( 'change', function() {
641 734 hideMultisiteSettingsIfDisabled();
642 735 });
643 736 hideMultisiteSettingsIfDisabled();
644 737
@@ -688,9 +781,12 @@
688 781 // Enable growable textarea for new user field.
689 782 $( 'textarea#new_approved_user_email' ).autogrow();
690 783
691 784 // Enable growable textarea for config fields.
785 + $( 'textarea#auth_settings_ldap_host' ).autogrow();
692 786 $( 'textarea#auth_settings_ldap_search_base' ).autogrow();
787 + $( 'textarea#auth_settings_ldap_search_filter' ).autogrow();
788 + $( 'textarea#auth_settings_oauth2_hosteddomain' ).autogrow();
693 789 $( 'textarea#auth_settings_google_hosteddomain' ).autogrow();
694 790
695 791 });
696 792
@@ -725,8 +821,11 @@
725 821
726 822 // Save user's active tab to sessionStorage (so we can restore it on reload).
727 823 // Note: session storage persists until the browser tab is closed.
728 824 sessionStorage.setItem( 'tab', listName );
825 +
826 + // Check whether to fade logo.
827 + fadeLogo();
729 828 };
730 829
731 830 // Hide (with overlay) site options if overridden by a multisite option.
732 831 window.hideMultisiteOverriddenOptions = function() {
@@ -738,10 +837,8 @@
738 837 'background-color': '#f1f1f1',
739 838 'z-index': 1,
740 839 opacity: 0.8,
741 840 position: 'absolute',
742 - top: optionContainerToHide.position().top,
743 - left: optionContainerToHide.position().left,
744 841 width: '100%',
745 842 height: optionContainerToHide.height(),
746 843 });
747 844 $( this ).show();
@@ -782,15 +879,14 @@
782 879 usermeta: usermeta,
783 880 nonce: nonce,
784 881 }, function( response ) {
785 882 var succeeded = response === 'success';
786 - var spinnerText = succeeded ? authL10n.saved + '.' : '<span style="color: red;">' + authL10n.failed + '.</span>';
883 + var spinnerText = succeeded ? authL10n.saved + '.' : '<span class="attention">' + authL10n.failed + '.</span>';
787 884 var spinnerWait = succeeded ? 500 : 2000;
788 885
789 886 // Enable inputs, remove spinner.
790 887 $caller.removeAttr( 'disabled' );
791 888 $usermeta.removeAttr( 'disabled' );
792 - $caller.css( 'display', 'none' );
793 889 $( 'form .spinner:not(:has(.spinner-text))' ).animate( { width: '60px' }, 'fast' ).append( '<span class="spinner-text">' + spinnerText + '</span>' ).delay( spinnerWait ).hide( animationSpeed, function() {
794 890 $( this ).remove();
795 891 });
796 892 $( 'html' ).removeClass( 'busy' );
@@ -796,15 +892,14 @@
796 892 $( 'html' ).removeClass( 'busy' );
797 893
798 894 }).fail( function() {
799 895 var succeeded = false;
800 - var spinnerText = succeeded ? authL10n.saved + '.' : '<span style="color: red;">' + authL10n.failed + '.</span>';
896 + var spinnerText = succeeded ? authL10n.saved + '.' : '<span class="attention">' + authL10n.failed + '.</span>';
801 897 var spinnerWait = succeeded ? 500 : 2000;
802 898
803 899 // Enable inputs, remove spinner.
804 900 $caller.removeAttr( 'disabled' );
805 901 $usermeta.removeAttr( 'disabled' );
806 - $caller.css( 'display', 'none' );
807 902 $( 'form .spinner:not(:has(.spinner-text))' ).animate( { width: '60px' }, 'fast' ).append( '<span class="spinner-text">' + spinnerText + '</span>' ).delay( spinnerWait ).hide( animationSpeed, function() {
808 903 $( this ).remove();
809 904 });
810 905 $( 'html' ).removeClass( 'busy' );
@@ -917,11 +1012,12 @@
917 1012 })
918 1013 );
919 1014
920 1015 // Add the new item.
921 - var authJsPrefix = isMultisite ? 'authMultisite' : 'auth';
922 - var localIcon = shouldCreateLocalAccount ? '&nbsp;<a title="' + authL10n.local_wordpress_user + '" class="auth-local-user"><span class="glyphicon glyphicon-user"></span></a>' : '';
923 - var banButton = list === 'approved' && ! isMultisite ? '<a class="button" id="block_user_' + nextId + '" onclick="' + authJsPrefix + 'AddUser( this, \'blocked\', false ); ' + authJsPrefix + 'IgnoreUser( this, \'approved\' );" title="' + authL10n.block_ban_user + '"><span class="glyphicon glyphicon-ban-circle"></span></a>' : '';
1016 + var authJsPrefix = isMultisite ? 'authMultisite' : 'auth';
1017 + var multisiteIcon = isMultisite ? '<a title="WordPress Multisite user" class="button disabled auth-multisite-user dashicons-before dashicons-admin-site"></a>' : '';
1018 + var banButton = isMultisite || 'approved' !== list ? '' : '<a class="button button-primary dashicons-before dashicons-remove" id="block_user_' + nextId + '" onclick="' + authJsPrefix + 'AddUser( this, \'blocked\', false ); ' + authJsPrefix + 'IgnoreUser( this, \'approved\' );" title="' + authL10n.block_ban_user + '"></a>';
1019 + var ignoreButton = '<a class="button dashicons-before dashicons-no" id="ignore_user_' + nextId + '" onclick="' + authJsPrefix + 'IgnoreUser( this, \'' + list + '\' );" title="' + authL10n.remove_user + '"></a>';
924 1020 $( ' \
925 1021 <li id="new_user_' + nextId + '" class="new-user" style="display: none;"> \
926 1022 <input type="text" id="auth_settings_access_users_' + list + '_' + nextId + '" name="auth_settings[access_users_' + list + '][' + nextId + '][email]" value="' + user.email + '" readonly="true" class="auth-email" /> \
927 1023 <select name="auth_settings[access_users_' + list + '][' + nextId + '][role]" class="auth-role" onchange="' + authJsPrefix + 'ChangeRole( this );"> \
@@ -926,11 +1022,9 @@
926 1022 <input type="text" id="auth_settings_access_users_' + list + '_' + nextId + '" name="auth_settings[access_users_' + list + '][' + nextId + '][email]" value="' + user.email + '" readonly="true" class="auth-email" /> \
927 1023 <select name="auth_settings[access_users_' + list + '][' + nextId + '][role]" class="auth-role" onchange="' + authJsPrefix + 'ChangeRole( this );"> \
928 1024 </select> \
929 1025 <input type="text" name="auth_settings[access_users_' + list + '][' + nextId + '][date_added]" value="' + getShortDate() + '" readonly="true" class="auth-date-added" /> \
930 - ' + banButton + ' \
931 - <a class="button" id="ignore_user_' + nextId + '" onclick="' + authJsPrefix + 'IgnoreUser( this, \'' + list + '\' );" title="' + authL10n.remove_user + '"><span class="glyphicon glyphicon-remove"></span></a> \
932 - ' + localIcon + ' \
1026 + ' + multisiteIcon + banButton + ignoreButton + ' \
933 1027 <span class="spinner is-active"></span> \
934 1028 </li> \
935 1029 ' ).appendTo( '#list_auth_settings_access_users_' + list ).slideDown( 250 );
936 1030
@@ -1034,18 +1128,23 @@
1034 1128 left: $( caller ).position().left + $( caller ).width() + 20,
1035 1129 });
1036 1130 $( caller ).after( $spinner );
1037 1131
1038 - // Get form elements to save
1039 - var nonce_save_auth_settings = $( '#nonce_save_auth_settings' ).val();
1132 + // Get form elements to save.
1133 + var params = {
1134 + action: 'save_auth_multisite_settings',
1135 + nonce: $( '#nonce_save_auth_settings' ).val(),
1136 + };
1040 1137
1041 - var multisite_override = $( '#auth_settings_multisite_override' ).is( ':checked' ) ? '1' : '';
1138 + params.multisite_override = $( '#auth_settings_multisite_override' ).is( ':checked' ) ? '1' : '';
1042 1139
1043 - var access_who_can_login = $( 'form input[name="auth_settings[access_who_can_login]"]:checked' ).val();
1140 + params.prevent_override_multisite = $( '#auth_settings_prevent_override_multisite' ).is( ':checked' ) ? '1' : '';
1044 1141
1045 - var access_who_can_view = $( 'form input[name="auth_settings[access_who_can_view]"]:checked' ).val();
1142 + params.access_who_can_login = $( 'form input[name="auth_settings[access_who_can_login]"]:checked' ).val();
1046 1143
1047 - var access_users_approved = {};
1144 + params.access_who_can_view = $( 'form input[name="auth_settings[access_who_can_view]"]:checked' ).val();
1145 +
1146 + params.access_users_approved = {};
1048 1147 $( '#list_auth_settings_access_users_approved li' ).each( function( index ) {
1049 1148 var user = {};
1050 1149 user.email = $( '.auth-email', this ).val();
1051 1150 user.role = $( '.auth-role', this ).val();
@@ -1050,45 +1149,61 @@
1050 1149 user.email = $( '.auth-email', this ).val();
1051 1150 user.role = $( '.auth-role', this ).val();
1052 1151 user.date_added = $( '.auth-date-added', this ).val();
1053 1152 user.local_user = $( '.auth-local-user', this ).length !== 0;
1054 - access_users_approved[index] = user;
1153 + params.access_users_approved[index] = user;
1055 1154 });
1056 1155
1057 - var access_default_role = $( '#auth_settings_access_default_role' ).val();
1156 + params.access_default_role = $( '#auth_settings_access_default_role' ).val();
1058 1157
1059 - var google = $( '#auth_settings_google' ).is( ':checked' ) ? '1' : '';
1060 - var google_clientid = $( '#auth_settings_google_clientid' ).val();
1061 - var google_clientsecret = $( '#auth_settings_google_clientsecret' ).val();
1062 - var google_hosteddomain = $( '#auth_settings_google_hosteddomain' ).val();
1158 + params.oauth2 = $( '#auth_settings_oauth2' ).is( ':checked' ) ? '1' : '';
1159 + params.oauth2_provider = $( '#auth_settings_oauth2_provider' ).val();
1160 + params.oauth2_custom_label = $( '#auth_settings_oauth2_custom_label' ).val();
1161 + params.oauth2_clientid = $( '#auth_settings_oauth2_clientid' ).val();
1162 + params.oauth2_clientsecret = $( '#auth_settings_oauth2_clientsecret' ).val();
1163 + params.oauth2_hosteddomain = $( '#auth_settings_oauth2_hosteddomain' ).val();
1164 + params.oauth2_tenant_id = $( '#auth_settings_oauth2_tenant_id' ).val();
1165 + params.oauth2_url_authorize = $( '#auth_settings_oauth2_url_authorize' ).val();
1166 + params.oauth2_url_token = $( '#auth_settings_oauth2_url_token' ).val();
1167 + params.oauth2_url_resource = $( '#auth_settings_oauth2_url_resource' ).val();
1168 + params.oauth2_auto_login = $( '#auth_settings_oauth2_auto_login' ).is( ':checked' ) ? '1' : '';
1063 1169
1064 - var cas = $( '#auth_settings_cas' ).is( ':checked' ) ? '1' : '';
1065 - var cas_custom_label = $( '#auth_settings_cas_custom_label' ).val();
1066 - var cas_host = $( '#auth_settings_cas_host' ).val();
1067 - var cas_port = $( '#auth_settings_cas_port' ).val();
1068 - var cas_path = $( '#auth_settings_cas_path' ).val();
1069 - var cas_version = $( '#auth_settings_cas_version' ).val();
1070 - var cas_attr_email = $( '#auth_settings_cas_attr_email' ).val();
1071 - var cas_attr_first_name = $( '#auth_settings_cas_attr_first_name' ).val();
1072 - var cas_attr_last_name = $( '#auth_settings_cas_attr_last_name' ).val();
1073 - var cas_attr_update_on_login = $( '#auth_settings_cas_attr_update_on_login' ).is( ':checked' ) ? '1' : '';
1074 - var cas_auto_login = $( '#auth_settings_cas_auto_login' ).is( ':checked' ) ? '1' : '';
1170 + params.google = $( '#auth_settings_google' ).is( ':checked' ) ? '1' : '';
1171 + params.google_clientid = $( '#auth_settings_google_clientid' ).val();
1172 + params.google_clientsecret = $( '#auth_settings_google_clientsecret' ).val();
1173 + params.google_hosteddomain = $( '#auth_settings_google_hosteddomain' ).val();
1075 1174
1076 - var ldap = $( '#auth_settings_ldap' ).is( ':checked' ) ? '1' : '';
1077 - var ldap_host = $( '#auth_settings_ldap_host' ).val();
1078 - var ldap_port = $( '#auth_settings_ldap_port' ).val();
1079 - var ldap_search_base = $( '#auth_settings_ldap_search_base' ).val();
1080 - var ldap_uid = $( '#auth_settings_ldap_uid' ).val();
1081 - var ldap_attr_email = $( '#auth_settings_ldap_attr_email' ).val();
1082 - var ldap_user = $( '#auth_settings_ldap_user' ).val();
1083 - var ldap_password = $( '#auth_settings_ldap_password' ).val();
1084 - var ldap_tls = $( '#auth_settings_ldap_tls' ).is( ':checked' ) ? '1' : '';
1085 - var ldap_lostpassword_url = $( '#auth_settings_ldap_lostpassword_url' ).val();
1086 - var ldap_attr_first_name = $( '#auth_settings_ldap_attr_first_name' ).val();
1087 - var ldap_attr_last_name = $( '#auth_settings_ldap_attr_last_name' ).val();
1088 - var ldap_attr_update_on_login = $( '#auth_settings_ldap_attr_update_on_login' ).is( ':checked' ) ? '1' : '';
1175 + params.cas = $( '#auth_settings_cas' ).is( ':checked' ) ? '1' : '';
1176 + params.cas_auto_login = $( '#auth_settings_cas_auto_login' ).is( ':checked' ) ? '1' : '';
1177 + params.cas_custom_label = $( '#auth_settings_cas_custom_label' ).val();
1178 + params.cas_host = $( '#auth_settings_cas_host' ).val();
1179 + params.cas_port = $( '#auth_settings_cas_port' ).val();
1180 + params.cas_path = $( '#auth_settings_cas_path' ).val();
1181 + params.cas_method = $( '#auth_settings_cas_method' ).val();
1182 + params.cas_version = $( '#auth_settings_cas_version' ).val();
1183 + params.cas_attr_email = $( '#auth_settings_cas_attr_email' ).val();
1184 + params.cas_attr_first_name = $( '#auth_settings_cas_attr_first_name' ).val();
1185 + params.cas_attr_last_name = $( '#auth_settings_cas_attr_last_name' ).val();
1186 + params.cas_attr_update_on_login = $( '#auth_settings_cas_attr_update_on_login' ).val();
1187 + params.cas_link_on_username = $( '#auth_settings_cas_link_on_username' ).is( ':checked' ) ? '1' : '';
1089 1188
1090 - var advanced_lockouts = {
1189 + params.ldap = $( '#auth_settings_ldap' ).is( ':checked' ) ? '1' : '';
1190 + params.ldap_host = $( '#auth_settings_ldap_host' ).val();
1191 + params.ldap_port = $( '#auth_settings_ldap_port' ).val();
1192 + params.ldap_search_base = $( '#auth_settings_ldap_search_base' ).val();
1193 + params.ldap_search_filter = $( '#auth_settings_ldap_search_filter' ).val();
1194 + params.ldap_uid = $( '#auth_settings_ldap_uid' ).val();
1195 + params.ldap_attr_email = $( '#auth_settings_ldap_attr_email' ).val();
1196 + params.ldap_user = $( '#auth_settings_ldap_user' ).val();
1197 + params.ldap_password = $( '#auth_settings_ldap_password' ).val();
1198 + params.ldap_tls = $( '#auth_settings_ldap_tls' ).is( ':checked' ) ? '1' : '';
1199 + params.ldap_lostpassword_url = $( '#auth_settings_ldap_lostpassword_url' ).val();
1200 + params.ldap_attr_first_name = $( '#auth_settings_ldap_attr_first_name' ).val();
1201 + params.ldap_attr_last_name = $( '#auth_settings_ldap_attr_last_name' ).val();
1202 + params.ldap_attr_update_on_login = $( '#auth_settings_ldap_attr_update_on_login' ).val();
1203 + params.ldap_test_user = $( '#auth_settings_ldap_test_user' ).val();
1204 +
1205 + params.advanced_lockouts = {
1091 1206 attempts_1: $( '#auth_settings_advanced_lockouts_attempts_1' ).val(),
1092 1207 duration_1: $( '#auth_settings_advanced_lockouts_duration_1' ).val(),
1093 1208 attempts_2: $( '#auth_settings_advanced_lockouts_attempts_2' ).val(),
1094 1209 duration_2: $( '#auth_settings_advanced_lockouts_duration_2' ).val(),
@@ -1093,59 +1208,18 @@
1093 1208 attempts_2: $( '#auth_settings_advanced_lockouts_attempts_2' ).val(),
1094 1209 duration_2: $( '#auth_settings_advanced_lockouts_duration_2' ).val(),
1095 1210 reset_duration: $( '#auth_settings_advanced_lockouts_reset_duration' ).val(),
1096 1211 };
1097 - var advanced_hide_wp_login = $( '#auth_settings_advanced_hide_wp_login' ).is( ':checked' ) ? '1' : '';
1098 - var advanced_widget_enabled = $( '#auth_settings_advanced_widget_enabled' ).is( ':checked' ) ? '1' : '';
1099 - var advanced_users_per_page = $( '#auth_settings_advanced_users_per_page' ).val();
1100 - var advanced_users_sort_by = $( '#auth_settings_advanced_users_sort_by' ).val();
1101 - var advanced_users_sort_order = $( '#auth_settings_advanced_users_sort_order' ).val();
1212 + params.advanced_hide_wp_login = $( '#auth_settings_advanced_hide_wp_login' ).is( ':checked' ) ? '1' : '';
1213 + params.advanced_disable_wp_login = $( '#auth_settings_advanced_disable_wp_login' ).is( ':checked' ) ? '1' : '';
1214 + params.advanced_widget_enabled = $( '#auth_settings_advanced_widget_enabled' ).is( ':checked' ) ? '1' : '';
1215 + params.advanced_users_per_page = $( '#auth_settings_advanced_users_per_page' ).val();
1216 + params.advanced_users_sort_by = $( '#auth_settings_advanced_users_sort_by' ).val();
1217 + params.advanced_users_sort_order = $( '#auth_settings_advanced_users_sort_order' ).val();
1102 1218
1103 - $.post( ajaxurl, {
1104 - action: 'save_auth_multisite_settings',
1105 - nonce: nonce_save_auth_settings,
1106 - multisite_override: multisite_override,
1107 - access_who_can_login: access_who_can_login,
1108 - access_who_can_view: access_who_can_view,
1109 - access_users_approved: access_users_approved,
1110 - access_default_role: access_default_role,
1111 - google: google,
1112 - google_clientid: google_clientid,
1113 - google_clientsecret: google_clientsecret,
1114 - google_hosteddomain: google_hosteddomain,
1115 - cas: cas,
1116 - cas_custom_label: cas_custom_label,
1117 - cas_host: cas_host,
1118 - cas_port: cas_port,
1119 - cas_path: cas_path,
1120 - cas_version: cas_version,
1121 - cas_attr_email: cas_attr_email,
1122 - cas_attr_first_name: cas_attr_first_name,
1123 - cas_attr_last_name: cas_attr_last_name,
1124 - cas_attr_update_on_login: cas_attr_update_on_login,
1125 - cas_auto_login: cas_auto_login,
1126 - ldap: ldap,
1127 - ldap_host: ldap_host,
1128 - ldap_port: ldap_port,
1129 - ldap_search_base: ldap_search_base,
1130 - ldap_uid: ldap_uid,
1131 - ldap_attr_email: ldap_attr_email,
1132 - ldap_user: ldap_user,
1133 - ldap_password: ldap_password,
1134 - ldap_tls: ldap_tls,
1135 - ldap_lostpassword_url: ldap_lostpassword_url,
1136 - ldap_attr_first_name: ldap_attr_first_name,
1137 - ldap_attr_last_name: ldap_attr_last_name,
1138 - ldap_attr_update_on_login: ldap_attr_update_on_login,
1139 - advanced_lockouts: advanced_lockouts,
1140 - advanced_hide_wp_login: advanced_hide_wp_login,
1141 - advanced_users_per_page: advanced_users_per_page,
1142 - advanced_users_sort_by: advanced_users_sort_by,
1143 - advanced_users_sort_order: advanced_users_sort_order,
1144 - advanced_widget_enabled: advanced_widget_enabled,
1145 - }, function( response ) {
1219 + $.post( ajaxurl, params, function( response ) {
1146 1220 var succeeded = response === 'success';
1147 - var spinnerText = succeeded ? authL10n.saved + '.' : '<span style="color: red;">' + authL10n.failed + '.</span>';
1221 + var spinnerText = succeeded ? authL10n.saved + '.' : '<span class="attention">' + authL10n.failed + '.</span>';
1148 1222 var spinnerWait = succeeded ? 500 : 2000;
1149 1223 $( 'form .spinner:not(:has(.spinner-text))' ).append( '<span class="spinner-text">' + spinnerText + '</span>' ).delay( spinnerWait ).hide( animationSpeed, function() {
1150 1224 $( this ).remove();
1151 1225 });
@@ -1155,9 +1229,9 @@
1155 1229 $( 'html' ).removeClass( 'busy' );
1156 1230 }).fail( function() {
1157 1231 // Fail fires if the server doesn't respond
1158 1232 var succeeded = false;
1159 - var spinnerText = succeeded ? authL10n.saved + '.' : '<span style="color: red;">' + authL10n.failed + '.</span>';
1233 + var spinnerText = succeeded ? authL10n.saved + '.' : '<span class="attention">' + authL10n.failed + '.</span>';
1160 1234 var spinnerWait = succeeded ? 500 : 2000;
1161 1235 $( 'form .spinner:not(:has(.spinner-text))' ).append( '<span class="spinner-text">' + spinnerText + '</span>' ).delay( spinnerWait ).hide( animationSpeed, function() {
1162 1236 $( this ).remove();
1163 1237 });
@@ -1167,8 +1241,29 @@
1167 1241 $( 'html' ).removeClass( 'busy' );
1168 1242 });
1169 1243 };
1170 1244 /* eslint-enable camelcase */
1245 +
1246 + // Fade in/out Authorizer logo in bottom right on Settings.
1247 + $(document).on( 'scroll', function () {
1248 + fadeLogo();
1249 + });
1250 +
1251 + function fadeLogo() {
1252 + if ( getScrollPercent() < 90 ) {
1253 + $( '#wpwrap' ).removeClass( 'not-faded' );
1254 + } else {
1255 + $( '#wpwrap' ).addClass( 'not-faded' );
1256 + }
1257 + }
1258 +
1259 + function getScrollPercent() {
1260 + var h = document.documentElement,
1261 + b = document.body,
1262 + st = 'scrollTop',
1263 + sh = 'scrollHeight';
1264 + return ( h[st] || b[st] ) / ( ( h[sh] || b[sh] ) - h.clientHeight ) * 100;
1265 + }
1171 1266
1172 1267 /* ========================================================================
1173 1268 * Portions below from Bootstrap.
1174 1269 * ========================================================================