checkconfigureproduct.tpl 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <script>
  2. function checkMailAddress ( mailname, maildomain, pid) {
  3. var xhttp = new XMLHttpRequest();
  4. xhttp.onreadystatechange = function() {
  5. if (this.readyState == 4 && this.status == 200) {
  6. if( this.responseText.trim() == 'yes') {
  7. console.log(this.responseText);
  8. $(customFields[4]).prop("disabled",false);
  9. $(customFields[5]).prop("disabled",true);
  10. $(customFields[2]).addClass('has-success');
  11. $(customFields[2]).css('background-color', '#0f03');;
  12. $("#hintHead").text('');
  13. $("#hintLength").text('');
  14. $("#hintNumeric").text('');
  15. $("#hintSymbols").text('');
  16. $("#hintUpperLower").text('');
  17. } else {
  18. console.log(this.responseText);
  19. $(customFields[4]).prop("disabled",true);
  20. $(customFields[5]).prop("disabled",true);
  21. $(customFields[2]).addClass('has-error');
  22. $(customFields[2]).css('background-color', '#f003');;
  23. $("#hintHead").text('Mailadresse ' + $(customFields[2]).val() + '@' + $(customFields[3]).val() + ' nicht verfügbar!');
  24. $("#hintLength").text('');
  25. $("#hintNumeric").text('');
  26. $("#hintSymbols").text('');
  27. $("#hintUpperLower").text('');
  28. }
  29. }
  30. };
  31. xhttp.open("GET", "modules/servers/zimbraSingle/zimbraAddressAvailable.php?name=" + mailname + '&domain=' + maildomain + '&pid=' + pid, true);
  32. xhttp.send();
  33. };
  34. jQuery(document).ready(function(){
  35. $("#btnCompleteProductConfig").prop("disabled",true);
  36. customFields = $("*[id^='customfield']");
  37. $(customFields[4]).prop("disabled",true);
  38. $(customFields[5]).prop("disabled",true);
  39. $(customFields[2]).blur(function () {
  40. checkMailAddress( $(customFields[2]).val(), $(customFields[3]).val(), {$productinfo['pid']});
  41. });
  42. $(customFields[3]).change(function () {
  43. checkMailAddress( $(customFields[2]).val(), $(customFields[3]).val(), {$productinfo['pid']});
  44. });
  45. $(customFields[4]).focus (function () {
  46. $("#hintHead").text('Tipps für ein gutes Passwort');
  47. $("#hintLength").text('Benutzen Sie mindestens 8 Zeichen');
  48. $("#hintNumeric").text('Benutzen Sie mindestens eine Zahl');
  49. $("#hintSymbols").text('Benutzen Sie auch mindestens eines der folgenden Symbole (# $ ! % + - etc...)');
  50. $("#hintUpperLower").text('Benutzen Sie Groß- und Kleinschreibung');
  51. });
  52. $(customFields[4]).keyup(function () {
  53. var pwlengthOK = false;
  54. var numericOK = false;
  55. var symbolsOK = false;
  56. var upperOK = false;
  57. var pw = $(customFields[4]).val();
  58. var pwlength = (pw.length);
  59. if (pwlength > 7) {
  60. pwlengthOK = true;
  61. $("#hintLength").text('');
  62. } else {
  63. pwlengthOK = false;
  64. $("#hintLength").text('Benutzen Sie mindestens 8 Zeichen');
  65. }
  66. var numeric = pw.replace(/[0-9]/g, "");
  67. var numnumeric = (pw.length - numeric.length);
  68. if (numnumeric > 0) {
  69. numericOK = true;
  70. $("#hintNumeric").text('');
  71. } else {
  72. numericOK = false;
  73. $("#hintNumeric").text('Benutzen Sie mindestens eine Zahl');
  74. }
  75. var symbols = pw.replace(/\W/g, "");
  76. var numsymbols = (pw.length - symbols.length);
  77. if (numsymbols > 0) {
  78. symbolsOK = true;
  79. $("#hintSymbols").text('');
  80. } else {
  81. symbolsOK = false;
  82. $("#hintSymbols").text('Benutzen Sie auch mindestens ein Symbol oder Sonderzeichen (# $ ! % & + - etc...)');
  83. }
  84. var upper = pw.replace(/[A-Z]/g, "");
  85. var numupper = (pw.length - upper.length);
  86. var lower = pw.replace(/[a-z]/g, "");
  87. var numlower = (pw.length - lower.length);
  88. if ((numupper > 0) && (numlower > 0)) {
  89. upperlowerOK = true;
  90. $("#hintUpperLower").text('');
  91. } else {
  92. upperlowerOK = false;
  93. $("#hintUpperLower").text('Benutzen Sie Groß- und Kleinschreibung');
  94. }
  95. $(customFields[4]).removeClass('has-error has-warning has-success');
  96. if (pwlengthOK && numericOK && symbolsOK && upperlowerOK) {
  97. $(customFields[5]).prop("disabled",false);
  98. $(customFields[4]).addClass('has-success');
  99. $(customFields[4]).css('background-color', '#0f03');;
  100. $("#hintHead").text('');
  101. } else {
  102. $(customFields[5]).prop("disabled",true);
  103. $(customFields[4]).addClass('has-error');
  104. $(customFields[4]).css('background-color', '#f003');;
  105. $("#hintHead").text('Tipps für ein gutes Passwort');
  106. }
  107. });
  108. $(customFields[5]).keyup(function () {
  109. if ($(customFields[5]).val() == $(customFields[4]).val()) {
  110. $("#btnCompleteProductConfig").prop("disabled",false);
  111. $(customFields[5]).addClass('has-success');
  112. $(customFields[5]).css('background-color', '#0f03');;
  113. $("#hintHead").text('');
  114. } else {
  115. $("#btnCompleteProductConfig").prop("disabled",true);
  116. $(customFields[5]).addClass('has-error');
  117. $(customFields[5]).css('background-color', '#f003');;
  118. $("#hintHead").text('Passworte stimmen nicht überein!');
  119. }
  120. });
  121. });
  122. </script>