| @@ -335,8 +335,11 @@ | ||
| 335 | 335 | <span class="fs-input-label"><?php echo $do_not_send_updates_text ?></span> |
| 336 | 336 | </label> |
| 337 | 337 | </div> |
| 338 | 338 | </div> |
| 339 | + <div id="fs_orphan_license_message"> | |
| 340 | + <span class="fs-message"><?php fs_echo_inline( "A user has not yet been associated with the license, which is necessary to prevent unauthorized activation. To assign the license to your user, you agree to share your WordPress user's full name and email address." ) ?></span> | |
| 341 | + </div> | |
| 339 | 342 | <?php endif ?> |
| 340 | 343 | <?php if ( $is_network_level_activation ) : ?> |
| 341 | 344 | <?php |
| 342 | 345 | $vars = array( |
| @@ -738,12 +741,13 @@ | ||
| 738 | 741 | |
| 739 | 742 | var |
| 740 | 743 | licenseKey = $licenseKeyInput.val(), |
| 741 | 744 | data = { |
| 742 | - action : action, | |
| 743 | - security : security, | |
| 744 | - license_key: licenseKey, | |
| 745 | - module_id : '<?php echo $fs->get_id() ?>' | |
| 745 | + action : action, | |
| 746 | + security : security, | |
| 747 | + license_key : licenseKey, | |
| 748 | + module_id : '<?php echo $fs->get_id() ?>', | |
| 749 | + license_owner_id: licenseOwnerIDByLicense[ licenseKey ] | |
| 746 | 750 | }; |
| 747 | 751 | |
| 748 | 752 | if ( |
| 749 | 753 | requireLicenseKey && |
| @@ -914,9 +918,9 @@ | ||
| 914 | 918 | } |
| 915 | 919 | |
| 916 | 920 | if ('' === key) { |
| 917 | 921 | $primaryCta.attr('disabled', 'disabled'); |
| 918 | - $marketingOptin.hide(); | |
| 922 | + hideOptinAndLicenseMessage(); | |
| 919 | 923 | } else { |
| 920 | 924 | $primaryCta.prop('disabled', false); |
| 921 | 925 | |
| 922 | 926 | if (32 <= key.length){ |
| @@ -921,9 +925,9 @@ | ||
| 921 | 925 | |
| 922 | 926 | if (32 <= key.length){ |
| 923 | 927 | fetchIsMarketingAllowedFlagAndToggleOptin(); |
| 924 | 928 | } else { |
| 925 | - $marketingOptin.hide(); | |
| 929 | + hideOptinAndLicenseMessage(); | |
| 926 | 930 | } |
| 927 | 931 | } |
| 928 | 932 | |
| 929 | 933 | previousLicenseKey = key; |
| @@ -957,10 +961,12 @@ | ||
| 957 | 961 | //-------------------------------------------------------------------------------- |
| 958 | 962 | //region GDPR |
| 959 | 963 | //-------------------------------------------------------------------------------- |
| 960 | 964 | var isMarketingAllowedByLicense = {}, |
| 961 | - $marketingOptin = $('#fs_marketing_optin'), | |
| 962 | - previousLicenseKey = null; | |
| 965 | + licenseOwnerIDByLicense = {}, | |
| 966 | + $marketingOptin = $( '#fs_marketing_optin' ), | |
| 967 | + $orphanLicenseMessage = $( '#fs_orphan_license_message' ), | |
| 968 | + previousLicenseKey = null; | |
| 963 | 969 | |
| 964 | 970 | if (requireLicenseKey) { |
| 965 | 971 | |
| 966 | 972 | var |
| @@ -980,8 +986,16 @@ | ||
| 980 | 986 | } else { |
| 981 | 987 | $marketingOptin.hide(); |
| 982 | 988 | $primaryCta.focus(); |
| 983 | 989 | } |
| 990 | + | |
| 991 | + $orphanLicenseMessage.toggle( false === licenseOwnerIDByLicense[ licenseKey ] ); | |
| 992 | + | |
| 993 | + if ( false !== licenseOwnerIDByLicense[ licenseKey ] ) { | |
| 994 | + $( 'input[name=user_firstname]' ).remove(); | |
| 995 | + $( 'input[name=user_lastname]' ).remove(); | |
| 996 | + $( 'input[name=user_email]' ).remove(); | |
| 997 | + } | |
| 984 | 998 | }, |
| 985 | 999 | /** |
| 986 | 1000 | * @author Leo Fajardo (@leorw) |
| 987 | 1001 | * @since 2.1.0 |
| @@ -989,9 +1003,10 @@ | ||
| 989 | 1003 | fetchIsMarketingAllowedFlagAndToggleOptin = function () { |
| 990 | 1004 | var licenseKey = $licenseKeyInput.val(); |
| 991 | 1005 | |
| 992 | 1006 | if (licenseKey.length < 32) { |
| 993 | - $marketingOptin.hide(); | |
| 1007 | + hideOptinAndLicenseMessage(); | |
| 1008 | + | |
| 994 | 1009 | return; |
| 995 | 1010 | } |
| 996 | 1011 | |
| 997 | 1012 | if (isMarketingAllowedByLicense.hasOwnProperty(licenseKey)) { |
| @@ -998,10 +1013,9 @@ | ||
| 998 | 1013 | afterMarketingFlagLoaded(); |
| 999 | 1014 | return; |
| 1000 | 1015 | } |
| 1001 | 1016 | |
| 1002 | - $marketingOptin.hide(); | |
| 1003 | - | |
| 1017 | + hideOptinAndLicenseMessage(); | |
| 1004 | 1018 | setLoadingMode(); |
| 1005 | 1019 | |
| 1006 | 1020 | $primaryCta.addClass('fs-loading'); |
| 1007 | 1021 | $primaryCta.attr('disabled', 'disabled'); |
| @@ -1023,13 +1037,18 @@ | ||
| 1023 | 1037 | result = result.data; |
| 1024 | 1038 | |
| 1025 | 1039 | // Cache result. |
| 1026 | 1040 | isMarketingAllowedByLicense[licenseKey] = result.is_marketing_allowed; |
| 1041 | + licenseOwnerIDByLicense[ licenseKey ] = result.license_owner_id; | |
| 1027 | 1042 | } |
| 1028 | 1043 | |
| 1029 | 1044 | afterMarketingFlagLoaded(); |
| 1030 | 1045 | } |
| 1031 | 1046 | }); |
| 1047 | + }, | |
| 1048 | + hideOptinAndLicenseMessage = function() { | |
| 1049 | + $marketingOptin.hide(); | |
| 1050 | + $orphanLicenseMessage.hide(); | |
| 1032 | 1051 | }; |
| 1033 | 1052 | |
| 1034 | 1053 | $marketingOptin.find( 'input' ).click(function() { |
| 1035 | 1054 | $marketingOptin.removeClass( 'error' ); |