class-jetpack-force-2fa.php
2 years ago
class.jetpack-sso-helpers.php
2 years ago
class.jetpack-sso-notices.php
4 years ago
class.jetpack-sso-user-admin.php
2 years ago
jetpack-sso-admin-create-user-rtl.css
2 years ago
jetpack-sso-admin-create-user-rtl.min.css
2 years ago
jetpack-sso-admin-create-user.css
2 years ago
jetpack-sso-admin-create-user.js
2 years ago
jetpack-sso-admin-create-user.min.css
2 years ago
jetpack-sso-login-rtl.css
4 years ago
jetpack-sso-login-rtl.min.css
4 years ago
jetpack-sso-login.css
4 years ago
jetpack-sso-login.js
2 years ago
jetpack-sso-login.min.css
4 years ago
jetpack-sso-users.js
2 years ago
jetpack-sso-admin-create-user.js
46 lines
| 1 | document.addEventListener( 'DOMContentLoaded', function () { |
| 2 | const sendUserNotificationCheckbox = document.getElementById( 'send_user_notification' ); |
| 3 | const userExternalContractorCheckbox = document.getElementById( 'user_external_contractor' ); |
| 4 | const inviteUserWpcomCheckbox = document.getElementById( 'invite_user_wpcom' ); |
| 5 | const customEmailMessageBlock = document.getElementById( 'custom_email_message_block' ); |
| 6 | |
| 7 | if ( inviteUserWpcomCheckbox && sendUserNotificationCheckbox && customEmailMessageBlock ) { |
| 8 | // Toggle Send User Notification checkbox enabled/disabled based on Invite User checkbox |
| 9 | // Enable External Contractor checkbox if Invite User checkbox is checked |
| 10 | // Show/hide the external email message field. |
| 11 | inviteUserWpcomCheckbox.addEventListener( 'change', function () { |
| 12 | sendUserNotificationCheckbox.disabled = inviteUserWpcomCheckbox.checked; |
| 13 | if ( inviteUserWpcomCheckbox.checked ) { |
| 14 | sendUserNotificationCheckbox.checked = false; |
| 15 | if ( userExternalContractorCheckbox ) { |
| 16 | userExternalContractorCheckbox.disabled = false; |
| 17 | } |
| 18 | customEmailMessageBlock.style.display = 'table'; |
| 19 | } else { |
| 20 | if ( userExternalContractorCheckbox ) { |
| 21 | userExternalContractorCheckbox.disabled = true; |
| 22 | userExternalContractorCheckbox.checked = false; |
| 23 | } |
| 24 | customEmailMessageBlock.style.display = 'none'; |
| 25 | } |
| 26 | } ); |
| 27 | |
| 28 | // On load, disable Send User Notification checkbox |
| 29 | // and show the custom email message if Invite User checkbox is checked |
| 30 | if ( inviteUserWpcomCheckbox.checked ) { |
| 31 | sendUserNotificationCheckbox.disabled = true; |
| 32 | sendUserNotificationCheckbox.checked = false; |
| 33 | customEmailMessageBlock.style.display = 'table'; |
| 34 | } |
| 35 | |
| 36 | // On load, disable External Contractor checkbox |
| 37 | // and hide the custom email message if Invite User checkbox is unchecked |
| 38 | if ( ! inviteUserWpcomCheckbox.checked ) { |
| 39 | if ( userExternalContractorCheckbox ) { |
| 40 | userExternalContractorCheckbox.disabled = true; |
| 41 | } |
| 42 | customEmailMessageBlock.style.display = 'none'; |
| 43 | } |
| 44 | } |
| 45 | } ); |
| 46 |