| @@ -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: '40%', | |
| 23 | + top: '45%', | |
| 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 + parseInt( $list.css( 'margin-top' ) ), | |
| 31 | + top: $list.position().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="button disabled first-page tablenav-pages-navspan" aria-hidden="true">«</span>' ); | |
| 106 | + $first.replaceWith( '<span class="first-page tablenav-pages-navspan" aria-hidden="true">«</span>' ); | |
| 107 | 107 | } else if ( $first.is( 'span' ) && currentPage > 1 ) { |
| 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">«</span></a>' ); | |
| 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">«</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="button disabled prev-page tablenav-pages-navspan" aria-hidden="true">‹</span>' ); | |
| 114 | + $prev.replaceWith( '<span class="prev-page tablenav-pages-navspan" aria-hidden="true">‹</span>' ); | |
| 115 | 115 | } else if ( currentPage > 1 ) { |
| 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">‹</span></a>' ); | |
| 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">‹</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="button disabled next-page tablenav-pages-navspan" aria-hidden="true">›</span>' ); | |
| 122 | + $next.replaceWith( '<span class="next-page tablenav-pages-navspan" aria-hidden="true">›</span>' ); | |
| 123 | 123 | } else if ( currentPage < totalPages ) { |
| 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">›</span></a>' ); | |
| 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">›</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="button disabled last-page tablenav-pages-navspan" aria-hidden="true">»</span>' ); | |
| 130 | + $last.replaceWith( '<span class="last-page tablenav-pages-navspan" aria-hidden="true">»</span>' ); | |
| 131 | 131 | } else if ( $last.is( 'span' ) && currentPage < totalPages ) { |
| 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">»</span></a>' ); | |
| 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">»</span></a>' ); | |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // Make changes to one of the user lists (pending, approved, blocked) via ajax. |
| @@ -329,14 +329,12 @@ | ||
| 329 | 329 | } |
| 330 | 330 | return matchingValues; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - // Helper function to check if an email address is valid. If allowWildcardEmail | |
| 334 | - // is true, then any string starting with an @ is valid. | |
| 335 | - function validEmail( email, allowWildcardEmail ) { | |
| 336 | - allowWildcardEmail = typeof allowWildcardEmail !== 'undefined' ? allowWildcardEmail : false; | |
| 333 | + // Helper function to check if an email address is valid. | |
| 334 | + function validEmail( email ) { | |
| 337 | 335 | var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
| 338 | - return email.length > 0 && ( re.test( email ) || email.startsWith( '@' ) ); | |
| 336 | + return email.length > 0 && re.test( email ); | |
| 339 | 337 | } |
| 340 | 338 | |
| 341 | 339 | // Helper function to set or update a querystring value. |
| 342 | 340 | function updateQueryStringParameter( uri, key, value ) { |
| @@ -397,9 +395,8 @@ | ||
| 397 | 395 | var auth_settings_external_cas_attr_first_name = $( '#auth_settings_cas_attr_first_name' ).closest( 'tr' ); |
| 398 | 396 | var auth_settings_external_cas_attr_last_name = $( '#auth_settings_cas_attr_last_name' ).closest( 'tr' ); |
| 399 | 397 | var auth_settings_external_cas_attr_update_on_login = $( '#auth_settings_cas_attr_update_on_login' ).closest( 'tr' ); |
| 400 | 398 | var auth_settings_external_cas_auto_login = $( '#auth_settings_cas_auto_login' ).closest( 'tr' ); |
| 401 | - var auth_settings_external_cas_link_on_username = $( '#auth_settings_cas_link_on_username' ).closest( 'tr' ); | |
| 402 | 399 | var auth_settings_external_ldap_host = $( '#auth_settings_ldap_host' ).closest( 'tr' ); |
| 403 | 400 | var auth_settings_external_ldap_port = $( '#auth_settings_ldap_port' ).closest( 'tr' ); |
| 404 | 401 | var auth_settings_external_ldap_search_base = $( '#auth_settings_ldap_search_base' ).closest( 'tr' ); |
| 405 | 402 | var auth_settings_external_ldap_uid = $( '#auth_settings_ldap_uid' ).closest( 'tr' ); |
| @@ -436,9 +433,8 @@ | ||
| 436 | 433 | $( 'th, td', auth_settings_external_cas_attr_first_name ).wrapInner( '<div class="animated_wrapper" />' ); |
| 437 | 434 | $( 'th, td', auth_settings_external_cas_attr_last_name ).wrapInner( '<div class="animated_wrapper" />' ); |
| 438 | 435 | $( 'th, td', auth_settings_external_cas_attr_update_on_login ).wrapInner( '<div class="animated_wrapper" />' ); |
| 439 | 436 | $( 'th, td', auth_settings_external_cas_auto_login ).wrapInner( '<div class="animated_wrapper" />' ); |
| 440 | - $( 'th, td', auth_settings_external_cas_link_on_username ).wrapInner( '<div class="animated_wrapper" />' ); | |
| 441 | 437 | $( 'th, td', auth_settings_external_ldap_host ).wrapInner( '<div class="animated_wrapper" />' ); |
| 442 | 438 | $( 'th, td', auth_settings_external_ldap_port ).wrapInner( '<div class="animated_wrapper" />' ); |
| 443 | 439 | $( 'th, td', auth_settings_external_ldap_search_base ).wrapInner( '<div class="animated_wrapper" />' ); |
| 444 | 440 | $( 'th, td', auth_settings_external_ldap_uid ).wrapInner( '<div class="animated_wrapper" />' ); |
| @@ -498,9 +494,8 @@ | ||
| 498 | 494 | animateOption( 'hide_immediately', auth_settings_external_cas_attr_first_name ); |
| 499 | 495 | animateOption( 'hide_immediately', auth_settings_external_cas_attr_last_name ); |
| 500 | 496 | animateOption( 'hide_immediately', auth_settings_external_cas_attr_update_on_login ); |
| 501 | 497 | animateOption( 'hide_immediately', auth_settings_external_cas_auto_login ); |
| 502 | - animateOption( 'hide_immediately', auth_settings_external_cas_link_on_username ); | |
| 503 | 498 | } |
| 504 | 499 | |
| 505 | 500 | // Hide LDAP options if unchecked |
| 506 | 501 | if ( ! $( '#auth_settings_ldap' ).is( ':checked' ) ) { |
| @@ -567,9 +562,8 @@ | ||
| 567 | 562 | animateOption( action, auth_settings_external_cas_attr_first_name ); |
| 568 | 563 | animateOption( action, auth_settings_external_cas_attr_last_name ); |
| 569 | 564 | animateOption( action, auth_settings_external_cas_attr_update_on_login ); |
| 570 | 565 | animateOption( action, auth_settings_external_cas_auto_login ); |
| 571 | - animateOption( action, auth_settings_external_cas_link_on_username ); | |
| 572 | 566 | }); |
| 573 | 567 | |
| 574 | 568 | // Event handler: Show/hide LDAP options based on checkbox |
| 575 | 569 | $( 'input[name="auth_settings[ldap]"]' ).change( function() { |
| @@ -850,10 +844,9 @@ | ||
| 850 | 844 | // Skip email address validation if adding from pending list (not user-editable). |
| 851 | 845 | var skipValidation = $( caller ).parent().parent().attr( 'id' ) === 'list_auth_settings_access_users_pending'; |
| 852 | 846 | |
| 853 | 847 | // Skip email address validation if we're banning an existing user (since they're already in a list). |
| 854 | - var blockingNewUser = $( caller ).attr( 'id' ).indexOf( 'block_user_new' ) > -1; | |
| 855 | - skipValidation = skipValidation || ( $( caller ).attr( 'id' ).indexOf( 'block_user' ) > -1 && ! blockingNewUser ); | |
| 848 | + skipValidation = skipValidation || $( caller ).attr( 'id' ).indexOf( 'block_user' ) > -1; | |
| 856 | 849 | |
| 857 | 850 | // Set default for multisite flag (run different save routine if multisite) |
| 858 | 851 | isMultisite = 'undefined' !== typeof isMultisite ? isMultisite : false; |
| 859 | 852 | |
| @@ -885,9 +878,9 @@ | ||
| 885 | 878 | // Remove any invalid email addresses. |
| 886 | 879 | if ( ! skipValidation ) { |
| 887 | 880 | // Check if the email(s) being added is well-formed. |
| 888 | 881 | emails = emails.filter( function( emailToValidate ) { |
| 889 | - return validEmail( emailToValidate, blockingNewUser ); | |
| 882 | + return validEmail( emailToValidate ); | |
| 890 | 883 | }); |
| 891 | 884 | // Remove any duplicates in the list of emails to add. |
| 892 | 885 | emails = removeDuplicatesFromArrayOfStrings( emails ); |
| 893 | 886 | } |
| @@ -1075,9 +1068,8 @@ | ||
| 1075 | 1068 | var cas_attr_first_name = $( '#auth_settings_cas_attr_first_name' ).val(); |
| 1076 | 1069 | var cas_attr_last_name = $( '#auth_settings_cas_attr_last_name' ).val(); |
| 1077 | 1070 | var cas_attr_update_on_login = $( '#auth_settings_cas_attr_update_on_login' ).is( ':checked' ) ? '1' : ''; |
| 1078 | 1071 | var cas_auto_login = $( '#auth_settings_cas_auto_login' ).is( ':checked' ) ? '1' : ''; |
| 1079 | - var cas_link_on_username = $( '#auth_settings_cas_link_on_username' ).is( ':checked' ) ? '1' : ''; | |
| 1080 | 1072 | |
| 1081 | 1073 | var ldap = $( '#auth_settings_ldap' ).is( ':checked' ) ? '1' : ''; |
| 1082 | 1074 | var ldap_host = $( '#auth_settings_ldap_host' ).val(); |
| 1083 | 1075 | var ldap_port = $( '#auth_settings_ldap_port' ).val(); |
| @@ -1127,9 +1119,8 @@ | ||
| 1127 | 1119 | cas_attr_first_name: cas_attr_first_name, |
| 1128 | 1120 | cas_attr_last_name: cas_attr_last_name, |
| 1129 | 1121 | cas_attr_update_on_login: cas_attr_update_on_login, |
| 1130 | 1122 | cas_auto_login: cas_auto_login, |
| 1131 | - cas_link_on_username: cas_link_on_username, | |
| 1132 | 1123 | ldap: ldap, |
| 1133 | 1124 | ldap_host: ldap_host, |
| 1134 | 1125 | ldap_port: ldap_port, |
| 1135 | 1126 | ldap_search_base: ldap_search_base, |