add_user.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. $(function () {
  2. $('#v_email').change(function () {
  3. if ($('#v_email_notify').prop('checked')) {
  4. document.getElementById('v_notify').value = document.getElementById('v_email').value;
  5. }
  6. });
  7. $('#v_email_notify').change(function () {
  8. if ($('#v_email_notify').prop('checked')) {
  9. document.getElementById('v_notify').value = document.getElementById('v_email').value;
  10. } else {
  11. document.getElementById('v_notify').value = '';
  12. }
  13. });
  14. });
  15. applyRandomPassword = function (min_length = 16) {
  16. const passwordInput = document.querySelector('input[name=v_password]');
  17. if (passwordInput) {
  18. passwordInput.value = randomString(min_length);
  19. VE.helpers.recalculatePasswordStrength(passwordInput);
  20. }
  21. };
  22. App.Listeners.WEB.keypress_v_password = function () {
  23. var ref = $('input[name="v_password"]');
  24. ref.bind('keypress input', function (evt) {
  25. clearTimeout(window.frp_usr_tmt);
  26. window.frp_usr_tmt = setTimeout(function () {
  27. VE.helpers.recalculatePasswordStrength(evt.target);
  28. }, 100);
  29. });
  30. };
  31. App.Listeners.WEB.keypress_v_password();