register.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. document.getElementById("loaderContainer").style.display = "flex";
  33. form.action = "merchant/create/none";
  34. form.method = "post";
  35. form.submit();
  36. }else{
  37. banner.createError("Please agree to the Privacy Policy and Terms and Conditions to continue");
  38. }
  39. }
  40. }