PluginProbe
Authorizer / 3.6.0
Authorizer v3.6.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 2.9.6 All 126 releases
← All changes | js/authorizer.js +152 -36 2.9.113.6.0 View file →
@@ -382,8 +382,17 @@
382 382 var auth_settings_access_public_pages = $( '#auth_settings_access_public_pages' ).closest( 'tr' );
383 383 var auth_settings_access_redirect_to_login = $( '#radio_auth_settings_access_redirect_to_login' ).closest( 'tr' );
384 384 var auth_settings_access_public_warning = $( '#radio_auth_settings_access_public_warning' ).closest( 'tr' );
385 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' );
386 395 var auth_settings_external_google_clientid = $( '#auth_settings_google_clientid' ).closest( 'tr' );
387 396 var auth_settings_external_google_clientsecret = $( '#auth_settings_google_clientsecret' ).closest( 'tr' );
388 397 var auth_settings_external_google_hosteddomain = $( '#auth_settings_google_hosteddomain' ).closest( 'tr' );
389 398 var auth_settings_external_cas_custom_label = $( '#auth_settings_cas_custom_label' ).closest( 'tr' );
@@ -389,8 +398,9 @@
389 398 var auth_settings_external_cas_custom_label = $( '#auth_settings_cas_custom_label' ).closest( 'tr' );
390 399 var auth_settings_external_cas_host = $( '#auth_settings_cas_host' ).closest( 'tr' );
391 400 var auth_settings_external_cas_port = $( '#auth_settings_cas_port' ).closest( 'tr' );
392 401 var auth_settings_external_cas_path = $( '#auth_settings_cas_path' ).closest( 'tr' );
402 + var auth_settings_external_cas_method = $( '#auth_settings_cas_method' ).closest( 'tr' );
393 403 var auth_settings_external_cas_version = $( '#auth_settings_cas_version' ).closest( 'tr' );
394 404 var auth_settings_external_cas_attr_email = $( '#auth_settings_cas_attr_email' ).closest( 'tr' );
395 405 var auth_settings_external_cas_attr_first_name = $( '#auth_settings_cas_attr_first_name' ).closest( 'tr' );
396 406 var auth_settings_external_cas_attr_last_name = $( '#auth_settings_cas_attr_last_name' ).closest( 'tr' );
@@ -399,8 +409,9 @@
399 409 var auth_settings_external_cas_link_on_username = $( '#auth_settings_cas_link_on_username' ).closest( 'tr' );
400 410 var auth_settings_external_ldap_host = $( '#auth_settings_ldap_host' ).closest( 'tr' );
401 411 var auth_settings_external_ldap_port = $( '#auth_settings_ldap_port' ).closest( 'tr' );
402 412 var auth_settings_external_ldap_search_base = $( '#auth_settings_ldap_search_base' ).closest( 'tr' );
413 + var auth_settings_external_ldap_search_filter = $( '#auth_settings_ldap_search_filter' ).closest( 'tr' );
403 414 var auth_settings_external_ldap_uid = $( '#auth_settings_ldap_uid' ).closest( 'tr' );
404 415 var auth_settings_external_ldap_attr_email = $( '#auth_settings_ldap_attr_email' ).closest( 'tr' );
405 416 var auth_settings_external_ldap_user = $( '#auth_settings_ldap_user' ).closest( 'tr' );
406 417 var auth_settings_external_ldap_password = $( '#auth_settings_ldap_password' ).closest( 'tr' );
@@ -408,8 +419,9 @@
408 419 var auth_settings_external_ldap_lostpassword_url = $( '#auth_settings_ldap_lostpassword_url' ).closest( 'tr' );
409 420 var auth_settings_external_ldap_attr_first_name = $( '#auth_settings_ldap_attr_first_name' ).closest( 'tr' );
410 421 var auth_settings_external_ldap_attr_last_name = $( '#auth_settings_ldap_attr_last_name' ).closest( 'tr' );
411 422 var auth_settings_external_ldap_attr_update_on_login = $( '#auth_settings_ldap_attr_update_on_login' ).closest( 'tr' );
423 + var auth_settings_external_ldap_test_user = $( '#auth_settings_ldap_test_user' ).closest( 'tr' );
412 424 /* eslint-enable */
413 425
414 426 // Wrap the th and td in the rows above so we can animate their heights (can't animate tr heights with jquery)
415 427 $( 'th, td', auth_settings_access_role_receive_pending_emails ).wrapInner( '<div class="animated_wrapper" />' );
@@ -421,8 +433,17 @@
421 433 $( 'th, td', auth_settings_access_public_pages ).wrapInner( '<div class="animated_wrapper" />' );
422 434 $( 'th, td', auth_settings_access_redirect_to_login ).wrapInner( '<div class="animated_wrapper" />' );
423 435 $( 'th, td', auth_settings_access_public_warning ).wrapInner( '<div class="animated_wrapper" />' );
424 436 $( 'th, td', auth_settings_access_redirect_to_message ).wrapInner( '<div class="animated_wrapper" />' );
437 + $( 'th, td', auth_settings_external_oauth2_provider ).wrapInner( '<div class="animated_wrapper" />' );
438 + $( 'th, td', auth_settings_external_oauth2_custom_label ).wrapInner( '<div class="animated_wrapper" />' );
439 + $( 'th, td', auth_settings_external_oauth2_clientid ).wrapInner( '<div class="animated_wrapper" />' );
440 + $( 'th, td', auth_settings_external_oauth2_clientsecret ).wrapInner( '<div class="animated_wrapper" />' );
441 + $( 'th, td', auth_settings_external_oauth2_hosteddomain ).wrapInner( '<div class="animated_wrapper" />' );
442 + $( 'th, td', auth_settings_external_oauth2_tenant_id ).wrapInner( '<div class="animated_wrapper" />' );
443 + $( 'th, td', auth_settings_external_oauth2_url_authorize ).wrapInner( '<div class="animated_wrapper" />' );
444 + $( 'th, td', auth_settings_external_oauth2_url_token ).wrapInner( '<div class="animated_wrapper" />' );
445 + $( 'th, td', auth_settings_external_oauth2_url_resource ).wrapInner( '<div class="animated_wrapper" />' );
425 446 $( 'th, td', auth_settings_external_google_clientid ).wrapInner( '<div class="animated_wrapper" />' );
426 447 $( 'th, td', auth_settings_external_google_clientsecret ).wrapInner( '<div class="animated_wrapper" />' );
427 448 $( 'th, td', auth_settings_external_google_hosteddomain ).wrapInner( '<div class="animated_wrapper" />' );
428 449 $( 'th, td', auth_settings_external_cas_custom_label ).wrapInner( '<div class="animated_wrapper" />' );
@@ -428,8 +449,9 @@
428 449 $( 'th, td', auth_settings_external_cas_custom_label ).wrapInner( '<div class="animated_wrapper" />' );
429 450 $( 'th, td', auth_settings_external_cas_host ).wrapInner( '<div class="animated_wrapper" />' );
430 451 $( 'th, td', auth_settings_external_cas_port ).wrapInner( '<div class="animated_wrapper" />' );
431 452 $( 'th, td', auth_settings_external_cas_path ).wrapInner( '<div class="animated_wrapper" />' );
453 + $( 'th, td', auth_settings_external_cas_method ).wrapInner( '<div class="animated_wrapper" />' );
432 454 $( 'th, td', auth_settings_external_cas_version ).wrapInner( '<div class="animated_wrapper" />' );
433 455 $( 'th, td', auth_settings_external_cas_attr_email ).wrapInner( '<div class="animated_wrapper" />' );
434 456 $( 'th, td', auth_settings_external_cas_attr_first_name ).wrapInner( '<div class="animated_wrapper" />' );
435 457 $( 'th, td', auth_settings_external_cas_attr_last_name ).wrapInner( '<div class="animated_wrapper" />' );
@@ -438,8 +460,9 @@
438 460 $( 'th, td', auth_settings_external_cas_link_on_username ).wrapInner( '<div class="animated_wrapper" />' );
439 461 $( 'th, td', auth_settings_external_ldap_host ).wrapInner( '<div class="animated_wrapper" />' );
440 462 $( 'th, td', auth_settings_external_ldap_port ).wrapInner( '<div class="animated_wrapper" />' );
441 463 $( 'th, td', auth_settings_external_ldap_search_base ).wrapInner( '<div class="animated_wrapper" />' );
464 + $( 'th, td', auth_settings_external_ldap_search_filter ).wrapInner( '<div class="animated_wrapper" />' );
442 465 $( 'th, td', auth_settings_external_ldap_uid ).wrapInner( '<div class="animated_wrapper" />' );
443 466 $( 'th, td', auth_settings_external_ldap_attr_email ).wrapInner( '<div class="animated_wrapper" />' );
444 467 $( 'th, td', auth_settings_external_ldap_user ).wrapInner( '<div class="animated_wrapper" />' );
445 468 $( 'th, td', auth_settings_external_ldap_password ).wrapInner( '<div class="animated_wrapper" />' );
@@ -447,16 +470,10 @@
447 470 $( 'th, td', auth_settings_external_ldap_lostpassword_url ).wrapInner( '<div class="animated_wrapper" />' );
448 471 $( 'th, td', auth_settings_external_ldap_attr_first_name ).wrapInner( '<div class="animated_wrapper" />' );
449 472 $( 'th, td', auth_settings_external_ldap_attr_last_name ).wrapInner( '<div class="animated_wrapper" />' );
450 473 $( 'th, td', auth_settings_external_ldap_attr_update_on_login ).wrapInner( '<div class="animated_wrapper" />' );
474 + $( 'th, td', auth_settings_external_ldap_test_user ).wrapInner( '<div class="animated_wrapper" />' );
451 475
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 476 // Hide settings unless "Only approved users" is checked
460 477 if ( ! $( '#radio_auth_settings_access_who_can_login_approved_users' ).is( ':checked' ) ) {
461 478 animateOption( 'hide_immediately', auth_settings_access_role_receive_pending_emails );
462 479 animateOption( 'hide_immediately', auth_settings_access_pending_redirect_to_message );
@@ -477,8 +494,29 @@
477 494 animateOption( 'hide_immediately', auth_settings_access_public_warning );
478 495 animateOption( 'hide_immediately', auth_settings_access_redirect_to_message );
479 496 }
480 497
498 + // Hide OAuth2 options if unchecked.
499 + if ( ! $( '#auth_settings_oauth2' ).is( ':checked' ) ) {
500 + animateOption( 'hide_immediately', auth_settings_external_oauth2_provider );
501 + animateOption( 'hide_immediately', auth_settings_external_oauth2_custom_label );
502 + animateOption( 'hide_immediately', auth_settings_external_oauth2_clientid );
503 + animateOption( 'hide_immediately', auth_settings_external_oauth2_clientsecret );
504 + animateOption( 'hide_immediately', auth_settings_external_oauth2_hosteddomain );
505 + }
506 +
507 + // Hide OAuth2 generic options if generic isn't chosen.
508 + if ( ! $( '#auth_settings_oauth2' ).is( ':checked' ) || 'generic' !== $( '#auth_settings_oauth2_provider' ).val() ) {
509 + animateOption( 'hide_immediately', auth_settings_external_oauth2_url_authorize );
510 + animateOption( 'hide_immediately', auth_settings_external_oauth2_url_token );
511 + animateOption( 'hide_immediately', auth_settings_external_oauth2_url_resource );
512 + }
513 +
514 + // Hide OAuth2 Tenant ID if azure isn't chosen.
515 + if ( ! $( '#auth_settings_oauth2' ).is( ':checked' ) || 'azure' !== $( '#auth_settings_oauth2_provider' ).val() ) {
516 + animateOption( 'hide_immediately', auth_settings_external_oauth2_tenant_id );
517 + }
518 +
481 519 // Hide Google options if unchecked
482 520 if ( ! $( '#auth_settings_google' ).is( ':checked' ) ) {
483 521 animateOption( 'hide_immediately', auth_settings_external_google_clientid );
484 522 animateOption( 'hide_immediately', auth_settings_external_google_clientsecret );
@@ -490,8 +528,9 @@
490 528 animateOption( 'hide_immediately', auth_settings_external_cas_custom_label );
491 529 animateOption( 'hide_immediately', auth_settings_external_cas_host );
492 530 animateOption( 'hide_immediately', auth_settings_external_cas_port );
493 531 animateOption( 'hide_immediately', auth_settings_external_cas_path );
532 + animateOption( 'hide_immediately', auth_settings_external_cas_method );
494 533 animateOption( 'hide_immediately', auth_settings_external_cas_version );
495 534 animateOption( 'hide_immediately', auth_settings_external_cas_attr_email );
496 535 animateOption( 'hide_immediately', auth_settings_external_cas_attr_first_name );
497 536 animateOption( 'hide_immediately', auth_settings_external_cas_attr_last_name );
@@ -504,8 +543,9 @@
504 543 if ( ! $( '#auth_settings_ldap' ).is( ':checked' ) ) {
505 544 animateOption( 'hide_immediately', auth_settings_external_ldap_host );
506 545 animateOption( 'hide_immediately', auth_settings_external_ldap_port );
507 546 animateOption( 'hide_immediately', auth_settings_external_ldap_search_base );
547 + animateOption( 'hide_immediately', auth_settings_external_ldap_search_filter );
508 548 animateOption( 'hide_immediately', auth_settings_external_ldap_uid );
509 549 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_email );
510 550 animateOption( 'hide_immediately', auth_settings_external_ldap_user );
511 551 animateOption( 'hide_immediately', auth_settings_external_ldap_password );
@@ -513,12 +553,13 @@
513 553 animateOption( 'hide_immediately', auth_settings_external_ldap_lostpassword_url );
514 554 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_first_name );
515 555 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_last_name );
516 556 animateOption( 'hide_immediately', auth_settings_external_ldap_attr_update_on_login );
557 + animateOption( 'hide_immediately', auth_settings_external_ldap_test_user );
517 558 }
518 559
519 560 // Event handler: Hide "Handle unauthorized visitors" option if access is granted to "Everyone"
520 - $( 'input[name="auth_settings[access_who_can_login]"]' ).change( function() {
561 + $( 'input[name="auth_settings[access_who_can_login]"]' ).on( 'change', function() {
521 562 // Hide settings unless "Only approved users" is checked
522 563 var action = $( '#radio_auth_settings_access_who_can_login_approved_users' ).is( ':checked' ) ? 'show' : 'hide';
523 564 animateOption( action, auth_settings_access_role_receive_pending_emails );
524 565 animateOption( action, auth_settings_access_pending_redirect_to_message );
@@ -529,9 +570,9 @@
529 570 animateOption( action, auth_settings_access_email_approved_users_body );
530 571 });
531 572
532 573 // Event handler: Hide Welcome email body/subject options if "Send welcome email" is off.
533 - $( 'input[name="auth_settings[access_should_email_approved_users]"]' ).change( function() {
574 + $( 'input[name="auth_settings[access_should_email_approved_users]"]' ).on( 'change', function() {
534 575 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
535 576 animateOption( action, auth_settings_access_email_approved_users_subject );
536 577 animateOption( action, auth_settings_access_email_approved_users_body );
537 578 });
@@ -536,9 +577,9 @@
536 577 animateOption( action, auth_settings_access_email_approved_users_body );
537 578 });
538 579
539 580 // Event handler: Hide "Handle unauthorized visitors" option if access is granted to "Everyone"
540 - $( 'input[name="auth_settings[access_who_can_view]"]' ).change( function() {
581 + $( 'input[name="auth_settings[access_who_can_view]"]' ).on( 'change', function() {
541 582 var action = $( '#radio_auth_settings_access_who_can_view_everyone' ).is( ':checked' ) ? 'hide' : 'show';
542 583 animateOption( action, auth_settings_access_redirect_to_login );
543 584 animateOption( action, auth_settings_access_redirect_to_message );
544 585 animateOption( action, auth_settings_access_public_pages );
@@ -544,10 +585,30 @@
544 585 animateOption( action, auth_settings_access_public_pages );
545 586 animateOption( action, auth_settings_access_public_warning );
546 587 });
547 588
589 + // Event handler: Show/hide OAuth2 options based on checkbox.
590 + $( 'input[name="auth_settings[oauth2]"]' ).on( 'change', function() {
591 + var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
592 + animateOption( action, auth_settings_external_oauth2_provider );
593 + animateOption( action, auth_settings_external_oauth2_custom_label );
594 + animateOption( action, auth_settings_external_oauth2_clientid );
595 + animateOption( action, auth_settings_external_oauth2_clientsecret );
596 + animateOption( action, auth_settings_external_oauth2_hosteddomain );
597 + });
598 +
599 + // Event handler: Show/hide OAuth2 generic options based on provider.
600 + $( 'select[name="auth_settings[oauth2_provider]"]' ).on( 'change', function() {
601 + var action = 'generic' === $( this ).val() ? 'show' : 'hide';
602 + animateOption( action, auth_settings_external_oauth2_url_authorize );
603 + animateOption( action, auth_settings_external_oauth2_url_token );
604 + animateOption( action, auth_settings_external_oauth2_url_resource );
605 + action = 'azure' === $( this ).val() ? 'show' : 'hide';
606 + animateOption( action, auth_settings_external_oauth2_tenant_id );
607 + });
608 +
548 609 // Event handler: Show/hide Google options based on checkbox
549 - $( 'input[name="auth_settings[google]"]' ).change( function() {
610 + $( 'input[name="auth_settings[google]"]' ).on( 'change', function() {
550 611 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
551 612 animateOption( action, auth_settings_external_google_clientid );
552 613 animateOption( action, auth_settings_external_google_clientsecret );
553 614 animateOption( action, auth_settings_external_google_hosteddomain );
@@ -553,14 +614,15 @@
553 614 animateOption( action, auth_settings_external_google_hosteddomain );
554 615 });
555 616
556 617 // Event handler: Show/hide CAS options based on checkbox
557 - $( 'input[name="auth_settings[cas]"]' ).change( function() {
618 + $( 'input[name="auth_settings[cas]"]' ).on( 'change', function() {
558 619 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
559 620 animateOption( action, auth_settings_external_cas_custom_label );
560 621 animateOption( action, auth_settings_external_cas_host );
561 622 animateOption( action, auth_settings_external_cas_port );
562 623 animateOption( action, auth_settings_external_cas_path );
624 + animateOption( action, auth_settings_external_cas_method );
563 625 animateOption( action, auth_settings_external_cas_version );
564 626 animateOption( action, auth_settings_external_cas_attr_email );
565 627 animateOption( action, auth_settings_external_cas_attr_first_name );
566 628 animateOption( action, auth_settings_external_cas_attr_last_name );
@@ -569,13 +631,14 @@
569 631 animateOption( action, auth_settings_external_cas_link_on_username );
570 632 });
571 633
572 634 // Event handler: Show/hide LDAP options based on checkbox
573 - $( 'input[name="auth_settings[ldap]"]' ).change( function() {
635 + $( 'input[name="auth_settings[ldap]"]' ).on( 'change', function() {
574 636 var action = $( this ).is( ':checked' ) ? 'show' : 'hide';
575 637 animateOption( action, auth_settings_external_ldap_host );
576 638 animateOption( action, auth_settings_external_ldap_port );
577 639 animateOption( action, auth_settings_external_ldap_search_base );
640 + animateOption( action, auth_settings_external_ldap_search_filter );
578 641 animateOption( action, auth_settings_external_ldap_uid );
579 642 animateOption( action, auth_settings_external_ldap_attr_email );
580 643 animateOption( action, auth_settings_external_ldap_user );
581 644 animateOption( action, auth_settings_external_ldap_password );
@@ -583,10 +646,30 @@
583 646 animateOption( action, auth_settings_external_ldap_lostpassword_url );
584 647 animateOption( action, auth_settings_external_ldap_attr_first_name );
585 648 animateOption( action, auth_settings_external_ldap_attr_last_name );
586 649 animateOption( action, auth_settings_external_ldap_attr_update_on_login );
650 + animateOption( action, auth_settings_external_ldap_test_user );
587 651 });
588 652
653 + // Event handler: Test LDAP settings.
654 + $( '#ldap_test_user_submit' ).on( 'click', function( event ) {
655 + event.preventDefault();
656 + $( 'html' ).addClass( 'busy' );
657 + $( '#ldap_test_user_spinner' ).addClass( 'is-active' );
658 +
659 + $.post( ajaxurl, {
660 + action: 'auth_settings_ldap_test_user',
661 + username: $( 'input[name="auth_settings[ldap_test_user]"]' ).val(),
662 + password: $( 'input#auth_settings_ldap_test_pass' ).val(),
663 + nonce: $( '#nonce_save_auth_settings' ).val(),
664 + }).done( function ( data ) {
665 + $( '#ldap_test_user_result' ).show().val( data.message );
666 + }).always( function () {
667 + $( 'html' ).removeClass( 'busy' );
668 + $( '#ldap_test_user_spinner' ).removeClass( 'is-active' );
669 + });
670 + } );
671 +
589 672 // Show save button if usermeta field is modified.
590 673 $( 'form input.auth-usermeta' ).on( 'keyup', function( event ) {
591 674 // Don't do anything if tab or arrow keys were pressed.
592 675 if ( event.which === 9 || event.which === 37 || event.which === 38 || event.which === 39 || event.which === 40 ) {
@@ -625,22 +708,26 @@
625 708 selectableHeader: '<div class="custom-header">' + authL10n.private_pages + '</div>',
626 709 selectionHeader: '<div class="custom-header">' + authL10n.public_pages + '</div>',
627 710 });
628 711
629 - // Switch to the first tab (or the tab indicated in sessionStorage, or the querystring).
630 - var tab = '';
631 - if ( getQuerystringValuesByKey( 'tab' ).length > 0 ) {
632 - tab = getQuerystringValuesByKey( 'tab' )[0];
633 - } else if ( sessionStorage.getItem( 'tab' ) ) {
634 - tab = sessionStorage.getItem( 'tab' );
712 + // Switch to the first tab (or the tab indicated in sessionStorage, or the
713 + // querystring). Note: only do this on the settings page, not the dashboard
714 + // widget.
715 + if ( ! $( '#auth_dashboard_widget' ).length ) {
716 + var tab = '';
717 + if ( getQuerystringValuesByKey( 'tab' ).length > 0 ) {
718 + tab = getQuerystringValuesByKey( 'tab' )[0];
719 + } else if ( sessionStorage.getItem( 'tab' ) ) {
720 + tab = sessionStorage.getItem( 'tab' );
721 + }
722 + if ( $.inArray( tab, [ 'access_lists', 'access_login', 'access_public', 'external', 'advanced' ] ) < 0 ) {
723 + tab = 'access_lists';
724 + }
725 + window.chooseTab( tab, animationSpeed );
635 726 }
636 - if ( $.inArray( tab, [ 'access_lists', 'access_login', 'access_public', 'external', 'advanced' ] ) < 0 ) {
637 - tab = 'access_lists';
638 - }
639 - window.chooseTab( tab, animationSpeed );
640 727
641 728 // Hide/show multisite settings based on override checkbox.
642 - $( 'input[name="auth_settings[multisite_override]"]' ).change( function() {
729 + $( 'input[name="auth_settings[multisite_override]"]' ).on( 'change', function() {
643 730 hideMultisiteSettingsIfDisabled();
644 731 });
645 732 hideMultisiteSettingsIfDisabled();
646 733
@@ -692,8 +779,10 @@
692 779
693 780 // Enable growable textarea for config fields.
694 781 $( 'textarea#auth_settings_ldap_host' ).autogrow();
695 782 $( 'textarea#auth_settings_ldap_search_base' ).autogrow();
783 + $( 'textarea#auth_settings_ldap_search_filter' ).autogrow();
784 + $( 'textarea#auth_settings_oauth2_hosteddomain' ).autogrow();
696 785 $( 'textarea#auth_settings_google_hosteddomain' ).autogrow();
697 786
698 787 });
699 788
@@ -744,10 +833,8 @@
744 833 'background-color': '#f1f1f1',
745 834 'z-index': 1,
746 835 opacity: 0.8,
747 836 position: 'absolute',
748 - top: optionContainerToHide.position().top,
749 - left: optionContainerToHide.position().left,
750 837 width: '100%',
751 838 height: optionContainerToHide.height(),
752 839 });
753 840 $( this ).show();
@@ -794,9 +881,8 @@
794 881
795 882 // Enable inputs, remove spinner.
796 883 $caller.removeAttr( 'disabled' );
797 884 $usermeta.removeAttr( 'disabled' );
798 - $caller.css( 'display', 'none' );
799 885 $( 'form .spinner:not(:has(.spinner-text))' ).animate( { width: '60px' }, 'fast' ).append( '<span class="spinner-text">' + spinnerText + '</span>' ).delay( spinnerWait ).hide( animationSpeed, function() {
800 886 $( this ).remove();
801 887 });
802 888 $( 'html' ).removeClass( 'busy' );
@@ -808,9 +894,8 @@
808 894
809 895 // Enable inputs, remove spinner.
810 896 $caller.removeAttr( 'disabled' );
811 897 $usermeta.removeAttr( 'disabled' );
812 - $caller.css( 'display', 'none' );
813 898 $( 'form .spinner:not(:has(.spinner-text))' ).animate( { width: '60px' }, 'fast' ).append( '<span class="spinner-text">' + spinnerText + '</span>' ).delay( spinnerWait ).hide( animationSpeed, function() {
814 899 $( this ).remove();
815 900 });
816 901 $( 'html' ).removeClass( 'busy' );
@@ -923,13 +1008,12 @@
923 1008 })
924 1009 );
925 1010
926 1011 // Add the new item.
927 - var authJsPrefix = isMultisite ? 'authMultisite' : 'auth';
928 - var banButton = ! isMultisite ? '<a class="button' + ( list === 'approved' ? '' : ' invisible' ) + '" 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>' : '';
929 - var ignoreButton = '<a class="button" id="ignore_user_' + nextId + '" onclick="' + authJsPrefix + 'IgnoreUser( this, \'' + list + '\' );" title="' + authL10n.remove_user + '"><span class="glyphicon glyphicon-remove"></span></a>';
930 - var localIcon = '&nbsp;<a title="' + authL10n.local_wordpress_user + '" class="auth-local-user' + ( shouldCreateLocalAccount ? '' : ' invisible' ) + '"><span class="glyphicon glyphicon-user"></span></a>';
931 - var multisiteIcon = '&nbsp;<a title="WordPress Multisite user" class="auth-multisite-user'+ ( isMultisite ? '' : ' invisible' ) + '"><span class="glyphicon glyphicon-globe"></span></a>';
1012 + var authJsPrefix = isMultisite ? 'authMultisite' : 'auth';
1013 + var multisiteIcon = isMultisite ? '<a title="WordPress Multisite user" class="button disabled auth-multisite-user dashicons-before dashicons-admin-site"></a>' : '';
1014 + 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>';
1015 + var ignoreButton = '<a class="button dashicons-before dashicons-no" id="ignore_user_' + nextId + '" onclick="' + authJsPrefix + 'IgnoreUser( this, \'' + list + '\' );" title="' + authL10n.remove_user + '"></a>';
932 1016 $( ' \
933 1017 <li id="new_user_' + nextId + '" class="new-user" style="display: none;"> \
934 1018 <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" /> \
935 1019 <select name="auth_settings[access_users_' + list + '][' + nextId + '][role]" class="auth-role" onchange="' + authJsPrefix + 'ChangeRole( this );"> \
@@ -934,9 +1018,9 @@
934 1018 <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" /> \
935 1019 <select name="auth_settings[access_users_' + list + '][' + nextId + '][role]" class="auth-role" onchange="' + authJsPrefix + 'ChangeRole( this );"> \
936 1020 </select> \
937 1021 <input type="text" name="auth_settings[access_users_' + list + '][' + nextId + '][date_added]" value="' + getShortDate() + '" readonly="true" class="auth-date-added" /> \
938 - ' + banButton + ignoreButton + localIcon + multisiteIcon + ' \
1022 + ' + multisiteIcon + banButton + ignoreButton + ' \
939 1023 <span class="spinner is-active"></span> \
940 1024 </li> \
941 1025 ' ).appendTo( '#list_auth_settings_access_users_' + list ).slideDown( 250 );
942 1026
@@ -1045,8 +1129,10 @@
1045 1129 var nonce_save_auth_settings = $( '#nonce_save_auth_settings' ).val();
1046 1130
1047 1131 var multisite_override = $( '#auth_settings_multisite_override' ).is( ':checked' ) ? '1' : '';
1048 1132
1133 + var prevent_override_multisite = $( '#auth_settings_prevent_override_multisite' ).is( ':checked' ) ? '1' : '';
1134 +
1049 1135 var access_who_can_login = $( 'form input[name="auth_settings[access_who_can_login]"]:checked' ).val();
1050 1136
1051 1137 var access_who_can_view = $( 'form input[name="auth_settings[access_who_can_view]"]:checked' ).val();
1052 1138
@@ -1061,8 +1147,19 @@
1061 1147 });
1062 1148
1063 1149 var access_default_role = $( '#auth_settings_access_default_role' ).val();
1064 1150
1151 + var oauth2 = $( '#auth_settings_oauth2' ).is( ':checked' ) ? '1' : '';
1152 + var oauth2_provider = $( '#auth_settings_oauth2_provider' ).val();
1153 + var oauth2_custom_label = $( '#auth_settings_oauth2_custom_label' ).val();
1154 + var oauth2_clientid = $( '#auth_settings_oauth2_clientid' ).val();
1155 + var oauth2_clientsecret = $( '#auth_settings_oauth2_clientsecret' ).val();
1156 + var oauth2_hosteddomain = $( '#auth_settings_oauth2_hosteddomain' ).val();
1157 + var oauth2_tenant_id = $( '#auth_settings_oauth2_tenant_id' ).val();
1158 + var oauth2_url_authorize = $( '#auth_settings_oauth2_url_authorize' ).val();
1159 + var oauth2_url_token = $( '#auth_settings_oauth2_url_token' ).val();
1160 + var oauth2_url_resource = $( '#auth_settings_oauth2_url_resource' ).val();
1161 +
1065 1162 var google = $( '#auth_settings_google' ).is( ':checked' ) ? '1' : '';
1066 1163 var google_clientid = $( '#auth_settings_google_clientid' ).val();
1067 1164 var google_clientsecret = $( '#auth_settings_google_clientsecret' ).val();
1068 1165 var google_hosteddomain = $( '#auth_settings_google_hosteddomain' ).val();
@@ -1071,13 +1168,14 @@
1071 1168 var cas_custom_label = $( '#auth_settings_cas_custom_label' ).val();
1072 1169 var cas_host = $( '#auth_settings_cas_host' ).val();
1073 1170 var cas_port = $( '#auth_settings_cas_port' ).val();
1074 1171 var cas_path = $( '#auth_settings_cas_path' ).val();
1172 + var cas_method = $( '#auth_settings_cas_method' ).val();
1075 1173 var cas_version = $( '#auth_settings_cas_version' ).val();
1076 1174 var cas_attr_email = $( '#auth_settings_cas_attr_email' ).val();
1077 1175 var cas_attr_first_name = $( '#auth_settings_cas_attr_first_name' ).val();
1078 1176 var cas_attr_last_name = $( '#auth_settings_cas_attr_last_name' ).val();
1079 - var cas_attr_update_on_login = $( '#auth_settings_cas_attr_update_on_login' ).is( ':checked' ) ? '1' : '';
1177 + var cas_attr_update_on_login = $( '#auth_settings_cas_attr_update_on_login' ).val();
1080 1178 var cas_auto_login = $( '#auth_settings_cas_auto_login' ).is( ':checked' ) ? '1' : '';
1081 1179 var cas_link_on_username = $( '#auth_settings_cas_link_on_username' ).is( ':checked' ) ? '1' : '';
1082 1180
1083 1181 var ldap = $( '#auth_settings_ldap' ).is( ':checked' ) ? '1' : '';
@@ -1083,8 +1181,9 @@
1083 1181 var ldap = $( '#auth_settings_ldap' ).is( ':checked' ) ? '1' : '';
1084 1182 var ldap_host = $( '#auth_settings_ldap_host' ).val();
1085 1183 var ldap_port = $( '#auth_settings_ldap_port' ).val();
1086 1184 var ldap_search_base = $( '#auth_settings_ldap_search_base' ).val();
1185 + var ldap_search_filter = $( '#auth_settings_ldap_search_filter' ).val();
1087 1186 var ldap_uid = $( '#auth_settings_ldap_uid' ).val();
1088 1187 var ldap_attr_email = $( '#auth_settings_ldap_attr_email' ).val();
1089 1188 var ldap_user = $( '#auth_settings_ldap_user' ).val();
1090 1189 var ldap_password = $( '#auth_settings_ldap_password' ).val();
@@ -1091,9 +1190,10 @@
1091 1190 var ldap_tls = $( '#auth_settings_ldap_tls' ).is( ':checked' ) ? '1' : '';
1092 1191 var ldap_lostpassword_url = $( '#auth_settings_ldap_lostpassword_url' ).val();
1093 1192 var ldap_attr_first_name = $( '#auth_settings_ldap_attr_first_name' ).val();
1094 1193 var ldap_attr_last_name = $( '#auth_settings_ldap_attr_last_name' ).val();
1095 - var ldap_attr_update_on_login = $( '#auth_settings_ldap_attr_update_on_login' ).is( ':checked' ) ? '1' : '';
1194 + var ldap_attr_update_on_login = $( '#auth_settings_ldap_attr_update_on_login' ).val();
1195 + var ldap_test_user = $( '#auth_settings_ldap_test_user' ).val();
1096 1196
1097 1197 var advanced_lockouts = {
1098 1198 attempts_1: $( '#auth_settings_advanced_lockouts_attempts_1' ).val(),
1099 1199 duration_1: $( '#auth_settings_advanced_lockouts_duration_1' ).val(),
@@ -1101,8 +1201,9 @@
1101 1201 duration_2: $( '#auth_settings_advanced_lockouts_duration_2' ).val(),
1102 1202 reset_duration: $( '#auth_settings_advanced_lockouts_reset_duration' ).val(),
1103 1203 };
1104 1204 var advanced_hide_wp_login = $( '#auth_settings_advanced_hide_wp_login' ).is( ':checked' ) ? '1' : '';
1205 + var advanced_disable_wp_login = $( '#auth_settings_advanced_disable_wp_login' ).is( ':checked' ) ? '1' : '';
1105 1206 var advanced_widget_enabled = $( '#auth_settings_advanced_widget_enabled' ).is( ':checked' ) ? '1' : '';
1106 1207 var advanced_users_per_page = $( '#auth_settings_advanced_users_per_page' ).val();
1107 1208 var advanced_users_sort_by = $( '#auth_settings_advanced_users_sort_by' ).val();
1108 1209 var advanced_users_sort_order = $( '#auth_settings_advanced_users_sort_order' ).val();
@@ -1110,12 +1211,23 @@
1110 1211 $.post( ajaxurl, {
1111 1212 action: 'save_auth_multisite_settings',
1112 1213 nonce: nonce_save_auth_settings,
1113 1214 multisite_override: multisite_override,
1215 + prevent_override_multisite: prevent_override_multisite,
1114 1216 access_who_can_login: access_who_can_login,
1115 1217 access_who_can_view: access_who_can_view,
1116 1218 access_users_approved: access_users_approved,
1117 1219 access_default_role: access_default_role,
1220 + oauth2: oauth2,
1221 + oauth2_provider: oauth2_provider,
1222 + oauth2_custom_label: oauth2_custom_label,
1223 + oauth2_clientid: oauth2_clientid,
1224 + oauth2_clientsecret: oauth2_clientsecret,
1225 + oauth2_hosteddomain: oauth2_hosteddomain,
1226 + oauth2_tenant_id: oauth2_tenant_id,
1227 + oauth2_url_authorize: oauth2_url_authorize,
1228 + oauth2_url_token: oauth2_url_token,
1229 + oauth2_url_resource: oauth2_url_resource,
1118 1230 google: google,
1119 1231 google_clientid: google_clientid,
1120 1232 google_clientsecret: google_clientsecret,
1121 1233 google_hosteddomain: google_hosteddomain,
@@ -1123,8 +1235,9 @@
1123 1235 cas_custom_label: cas_custom_label,
1124 1236 cas_host: cas_host,
1125 1237 cas_port: cas_port,
1126 1238 cas_path: cas_path,
1239 + cas_method: cas_method,
1127 1240 cas_version: cas_version,
1128 1241 cas_attr_email: cas_attr_email,
1129 1242 cas_attr_first_name: cas_attr_first_name,
1130 1243 cas_attr_last_name: cas_attr_last_name,
@@ -1134,8 +1247,9 @@
1134 1247 ldap: ldap,
1135 1248 ldap_host: ldap_host,
1136 1249 ldap_port: ldap_port,
1137 1250 ldap_search_base: ldap_search_base,
1251 + ldap_search_filter: ldap_search_filter,
1138 1252 ldap_uid: ldap_uid,
1139 1253 ldap_attr_email: ldap_attr_email,
1140 1254 ldap_user: ldap_user,
1141 1255 ldap_password: ldap_password,
@@ -1143,10 +1257,12 @@
1143 1257 ldap_lostpassword_url: ldap_lostpassword_url,
1144 1258 ldap_attr_first_name: ldap_attr_first_name,
1145 1259 ldap_attr_last_name: ldap_attr_last_name,
1146 1260 ldap_attr_update_on_login: ldap_attr_update_on_login,
1261 + ldap_test_user: ldap_test_user,
1147 1262 advanced_lockouts: advanced_lockouts,
1148 1263 advanced_hide_wp_login: advanced_hide_wp_login,
1264 + advanced_disable_wp_login: advanced_disable_wp_login,
1149 1265 advanced_users_per_page: advanced_users_per_page,
1150 1266 advanced_users_sort_by: advanced_users_sort_by,
1151 1267 advanced_users_sort_order: advanced_users_sort_order,
1152 1268 advanced_widget_enabled: advanced_widget_enabled,