register.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. console.log("something");
  20. let form = document.querySelector("#registerStrand form");
  21. let checkbox = document.getElementById("checkAgree");
  22. if(!checkbox.checked){
  23. banner.createError("Please agree to the Privacy Policy and Terms and Conditions to continue");
  24. return;
  25. }
  26. let pass = document.getElementById("regPass").value;
  27. let confirmPass = document.getElementById("regConfirmPass").value;
  28. if(pass !== confirmPass){
  29. banner.createError("Your passwords do not match");
  30. return;
  31. }
  32. if(checkbox.checked){
  33. document.getElementById("loaderContainer").style.display = "flex";
  34. form.action = "merchant/create/none";
  35. form.method = "post";
  36. form.submit();
  37. }else{
  38. banner.createError("Please agree to the Privacy Policy and Terms and Conditions to continue");
  39. }
  40. }
  41. }