Răsfoiți Sursa

Remove email from the merchant on the frontend.
Email is now on the owner object inside the merchant.

Lee Morgan 5 ani în urmă
părinte
comite
c925d1bffc

+ 1 - 0
controllers/passwordReset.js

@@ -1,3 +1,4 @@
+const Owner = require("../models/owner.js");
 const Merchant = require("../models/merchant.js");
 
 const passwordReset = require("../emails/passwordReset.js");

+ 0 - 2
views/dashboardPage/js/classes/Merchant.js

@@ -73,7 +73,6 @@ class MerchantIngredient{
 class Merchant{
         constructor(
             name,
-            email,
             pos,
             ingredients,
             recipes,
@@ -81,7 +80,6 @@ class Merchant{
             owner
         ){
         this._name = name;
-        this._email = email;
         this._pos = pos;
         this._ingredients = [];
         this._recipes = [];

+ 0 - 1
views/dashboardPage/js/dashboard.js

@@ -25,7 +25,6 @@ const Merchant = require("./classes/Merchant.js");
 
 window.merchant = new Merchant(
     data.merchant.name,
-    data.owner.email,
     data.merchant.pos,
     data.merchant.inventory,
     data.merchant.recipes,

+ 0 - 1
views/dashboardPage/js/modal.js

@@ -73,7 +73,6 @@ let modal = {
                 }else{
                     let newMerchant = new Merchant(
                         response[1].name,
-                        response[0].email,
                         response[1].pos,
                         response[1].inventory,
                         response[1].recipes,

+ 2 - 5
views/dashboardPage/js/strands/account.js

@@ -3,7 +3,7 @@ const Merchant = require("../classes/Merchant");
 let account = {
     display: function(){
         document.getElementById("accountStrandTitle").innerText = merchant.name;
-        document.getElementById("accountEmail").value = merchant.email;
+        document.getElementById("accountEmail").value = merchant.owner.email;
 
         document.getElementById("accountUpdate").onclick = ()=>{this.updateData()};
         document.getElementById("deleteMerchant").onclick = ()=>{controller.openModal("confirmDeleteMerchant")};
@@ -64,9 +64,8 @@ let account = {
                     controller.createBanner(response, "error");
                 }else{
                     controller.createBanner("DATA UPDATED", "success");
-                    if(response.email !== merchant.email) controller.createBanner("YOU MUST VALIDATE YOUR NEW EMAIL ADDRESS BEFORE YOU CAN LOG IN AGAIN", "alert");
+                    controller.createBanner("YOU MUST VALIDATE YOUR NEW EMAIL ADDRESS BEFORE YOU CAN LOG IN AGAIN", "alert");
 
-                    merchant.email = response.email;
                     merchant.owner.email = response.email;
                     document.getElementById("accountEmail").value = merchant.owner.email;
                 }
@@ -128,7 +127,6 @@ let account = {
                 }else{
                     window.merchant = new Merchant(
                         response[1].name,
-                        response[0].email,
                         response[1].pos,
                         response[1].inventory,
                         response[1].recipes,
@@ -160,7 +158,6 @@ let account = {
                 }else{
                     window.merchant = new Merchant(
                         response[1].name,
-                        response[0].email,
                         response[1].pos,
                         response[1].inventory,
                         response[1].recipes,