register.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. let registerObj = {
  2. display: function(){
  3. controller.clearScreen();
  4. controller.registerStrand.style.display = "flex";
  5. document.getElementById("checkAgree").checked = false;
  6. document.getElementById("regButton").classList = "buttonDisabled";
  7. },
  8. agreement: function(){
  9. let checkbox = document.getElementById("checkAgree");
  10. let button = document.getElementById("regButton");
  11. if(checkbox.checked){
  12. button.classList = "button";
  13. }else{
  14. button.classList = "buttonDisabled";
  15. }
  16. },
  17. submit: function(){
  18. event.preventDefault();
  19. let form = document.querySelector("#registerStrand form");
  20. let checkbox = document.getElementById("checkAgree");
  21. if(!checkbox.checked){
  22. banner.createError("Please agree to the Privacy Policy and Terms and Conditions to continue");
  23. return;
  24. }
  25. let pass = document.getElementById("regPass").value;
  26. let confirmPass = document.getElementById("regConfirmPass").value;
  27. if(pass !== confirmPass){
  28. banner.createError("Your passwords do not match");
  29. return;
  30. }
  31. if(checkbox.checked){
  32. if(validator.isSanitary(document.getElementById("regName").value)){
  33. document.getElementById("loaderContainer").style.display = "flex";
  34. form.action = "merchant/create/none";
  35. form.method = "post";
  36. form.submit();
  37. }
  38. }else{
  39. banner.createError("Please agree to the Privacy Policy and Terms and Conditions to continue");
  40. }
  41. }
  42. }