Skip to content

Commit

Permalink
Update sprout.js
Browse files Browse the repository at this point in the history
  • Loading branch information
camillereaves authored Sep 23, 2023
1 parent db2f838 commit 93a3b60
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions public/sprout.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,14 @@ function generateUsername(userNameExists, firstName, lastName, month, day, year)

async function testUserEmail(testEmail){
testEmail = testEmail.toString();
const q = query(newUserRequest, where('UserEmail', '==', testEmail));
const checkEmail = (await getDocs(q)).docs.length;
if (checkEmail > 0){
const q = query((db, 'new_user_requests'), where('UserEmail', '==', testEmail));
const checkEmail = await getDocs(q);
let count = 0;
checkEmail.forEach((doc) => {
count += 1;
});
console.log("checkEmail = " + count);
if (count > 0){
return true;
} else{
return false;
Expand All @@ -191,9 +196,13 @@ async function testUserEmail(testEmail){
async function testUserName(testUsername){
testUsername = testUsername.toString();
const docRef = doc(db, 'new_user_requests', testUsername);
const docCheck = await getDoc(docRef);
console.log("docCheck = "+ docCheck);
if (docCheck.exists){
const docCheck = await getDocs(docRef);
let count = 0;
docCheck.forEach((doc) => {
count += 1;
});
console.log("docCheck = "+ count);
if (count > 0){
return true;
} else{
return false;
Expand Down

0 comments on commit 93a3b60

Please sign in to comment.