| @@ -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 ) { |
| @@ -846,10 +844,9 @@ | ||
| 846 | 844 | // Skip email address validation if adding from pending list (not user-editable). |
| 847 | 845 | var skipValidation = $( caller ).parent().parent().attr( 'id' ) === 'list_auth_settings_access_users_pending'; |
| 848 | 846 | |
| 849 | 847 | // Skip email address validation if we're banning an existing user (since they're already in a list). |
| 850 | - var blockingNewUser = $( caller ).attr( 'id' ).indexOf( 'block_user_new' ) > -1; | |
| 851 | - skipValidation = skipValidation || ( $( caller ).attr( 'id' ).indexOf( 'block_user' ) > -1 && ! blockingNewUser ); | |
| 848 | + skipValidation = skipValidation || $( caller ).attr( 'id' ).indexOf( 'block_user' ) > -1; | |
| 852 | 849 | |
| 853 | 850 | // Set default for multisite flag (run different save routine if multisite) |
| 854 | 851 | isMultisite = 'undefined' !== typeof isMultisite ? isMultisite : false; |
| 855 | 852 | |
| @@ -881,9 +878,9 @@ | ||
| 881 | 878 | // Remove any invalid email addresses. |
| 882 | 879 | if ( ! skipValidation ) { |
| 883 | 880 | // Check if the email(s) being added is well-formed. |
| 884 | 881 | emails = emails.filter( function( emailToValidate ) { |
| 885 | - return validEmail( emailToValidate, blockingNewUser ); | |
| 882 | + return validEmail( emailToValidate ); | |
| 886 | 883 | }); |
| 887 | 884 | // Remove any duplicates in the list of emails to add. |
| 888 | 885 | emails = removeDuplicatesFromArrayOfStrings( emails ); |
| 889 | 886 | } |