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 b1955fb commit 4b2829f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions public/sprout.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ document.getElementById("login_form").addEventListener("submit", async function
const date = new Date();
let month = String(date.getMonth()+1).padStart(2,"0");
let year = String(date.getFullYear()).slice(2);

let userNameCount = await testUserName(firstName.slice(0,1).toLowerCase() + lastName.toLowerCase() + month + year);

if(userNameCount > 0){
username = firstName.slice(0,1).toLowerCase() + lastName.toLowerCase() + month + year + userNameCount;
let username = firstName.slice(0,1).toLowerCase() + lastName.toLowerCase() + month + year + userNameCount;
}
else{
username = firstName.slice(0,1).toLowerCase() + lastName.toLowerCase() + month + year;
let username = firstName.slice(0,1).toLowerCase() + lastName.toLowerCase() + month + year;
}

const newUser = {
Expand Down Expand Up @@ -180,7 +179,7 @@ async function testUserEmail(testEmail){
}

async function testUserName(testUsername){
const docCheck = await getDoc(doc(db, newUserRequest, username));
const docCheck = await getDoc(doc(db, newUserRequest, testUsername));

if (!query.empty) {
count = query.data().count;
Expand Down

0 comments on commit 4b2829f

Please sign in to comment.