From b3e6533ceff67904525bb41c73bb9f4da11be972 Mon Sep 17 00:00:00 2001 From: Camille Reaves Date: Sun, 24 Sep 2023 21:42:51 -0400 Subject: [PATCH 1/6] Update forgotpassword.js --- public/forgotpassword.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/forgotpassword.js b/public/forgotpassword.js index c5626b0..1bc19f6 100644 --- a/public/forgotpassword.js +++ b/public/forgotpassword.js @@ -68,7 +68,7 @@ async function fetchUser(username){ const userData = []; username = username.toString(); const q = query(users, where('username', '==', username)); - const getUsers = await getDocs(q).then((querySnapshot) => { + const getUsers = (await getDocs(q)).then((querySnapshot) => { const tempDoc = []; tempDoc.push({ id: doc.id, ...doc.data() }); userData = tempDoc; From 17a427638011138ff57cf1045865dcc23bf7cb31 Mon Sep 17 00:00:00 2001 From: Camille Reaves Date: Sun, 24 Sep 2023 21:45:37 -0400 Subject: [PATCH 2/6] Update forgotpassword.js --- public/forgotpassword.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/forgotpassword.js b/public/forgotpassword.js index 1bc19f6..c932d8b 100644 --- a/public/forgotpassword.js +++ b/public/forgotpassword.js @@ -70,7 +70,9 @@ async function fetchUser(username){ const q = query(users, where('username', '==', username)); const getUsers = (await getDocs(q)).then((querySnapshot) => { const tempDoc = []; - tempDoc.push({ id: doc.id, ...doc.data() }); + querySnapshot.forEach((doc) => { + tempDoc.push({ id: doc.id, ...doc.data() }); + }); userData = tempDoc; }) if(userData.userEmail == userEmail){ From 21fd19688ff0b1e85d152f9c65a7f62c7d4fec10 Mon Sep 17 00:00:00 2001 From: Camille Reaves Date: Sun, 24 Sep 2023 21:47:13 -0400 Subject: [PATCH 3/6] Update forgotpassword.js --- public/forgotpassword.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/forgotpassword.js b/public/forgotpassword.js index c932d8b..95ce012 100644 --- a/public/forgotpassword.js +++ b/public/forgotpassword.js @@ -68,7 +68,7 @@ async function fetchUser(username){ const userData = []; username = username.toString(); const q = query(users, where('username', '==', username)); - const getUsers = (await getDocs(q)).then((querySnapshot) => { + const getUsers = await getDocs(q).then((querySnapshot) => { const tempDoc = []; querySnapshot.forEach((doc) => { tempDoc.push({ id: doc.id, ...doc.data() }); From 994ac81de366a0724bfe90ef3863a40a802a3fdd Mon Sep 17 00:00:00 2001 From: Camille Reaves Date: Sun, 24 Sep 2023 21:49:14 -0400 Subject: [PATCH 4/6] Update forgotpassword.js --- public/forgotpassword.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/forgotpassword.js b/public/forgotpassword.js index 95ce012..cda7179 100644 --- a/public/forgotpassword.js +++ b/public/forgotpassword.js @@ -65,7 +65,7 @@ async function validateNewPassword(password, user){ async function fetchUser(username){ try{ - const userData = []; + var userData = []; username = username.toString(); const q = query(users, where('username', '==', username)); const getUsers = await getDocs(q).then((querySnapshot) => { From 4d659cfe5c3f906c6380bdd809233860ebb680a6 Mon Sep 17 00:00:00 2001 From: Camille Reaves Date: Sun, 24 Sep 2023 21:53:36 -0400 Subject: [PATCH 5/6] Update forgotpassword.js --- public/forgotpassword.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/forgotpassword.js b/public/forgotpassword.js index cda7179..5dd6a10 100644 --- a/public/forgotpassword.js +++ b/public/forgotpassword.js @@ -63,10 +63,11 @@ async function validateNewPassword(password, user){ return true; } -async function fetchUser(username){ +async function fetchUser(username, userEmail){ try{ var userData = []; username = username.toString(); + userEmail = userEmail.toString(); const q = query(users, where('username', '==', username)); const getUsers = await getDocs(q).then((querySnapshot) => { const tempDoc = []; @@ -82,7 +83,8 @@ async function fetchUser(username){ return false; } } catch(error) { - console.log(error) + console.log(error); + alert("Please enter the correct username and e-mail associated with the account before proceeding."); } return false; } From e60054568cd1eaa4d2ee034b1335a47c1d0c05e2 Mon Sep 17 00:00:00 2001 From: Camille Reaves Date: Sun, 24 Sep 2023 21:55:28 -0400 Subject: [PATCH 6/6] Update forgotpassword.js --- public/forgotpassword.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/forgotpassword.js b/public/forgotpassword.js index 5dd6a10..20e87ad 100644 --- a/public/forgotpassword.js +++ b/public/forgotpassword.js @@ -63,11 +63,11 @@ async function validateNewPassword(password, user){ return true; } -async function fetchUser(username, userEmail){ +async function fetchUser(username/*, userEmail*/){ try{ var userData = []; username = username.toString(); - userEmail = userEmail.toString(); + //userEmail = userEmail.toString(); const q = query(users, where('username', '==', username)); const getUsers = await getDocs(q).then((querySnapshot) => { const tempDoc = []; @@ -76,12 +76,12 @@ async function fetchUser(username, userEmail){ }); userData = tempDoc; }) - if(userData.userEmail == userEmail){ - return userData; - } else { - console.log("userData error, userData = " + userData); - return false; - } + //if(userData.userEmail == userEmail){ + return userData; + //} else { + // console.log("userData error, userData = " + userData); + // return false; + //} } catch(error) { console.log(error); alert("Please enter the correct username and e-mail associated with the account before proceeding.");