From 352cac2e2107b076b6f7ee2ae57c00e78ec24569 Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 4 Jul 2020 13:08:37 +0100 Subject: [PATCH] made sure registering actually works --- public/js/account.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/js/account.js b/public/js/account.js index 671cb22b2..e1effdc82 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -135,6 +135,11 @@ function signUp() { }) .then(function () { // Update successful. + firebase + .firestore() + .collection("users") + .doc(usr.uid) + .set({ name: nname }, { merge: true }); showNotification("Account created", 2000); $("#menu .icon-button.account .text").text(nname); try { @@ -147,11 +152,12 @@ function signUp() { }) .catch(function (error) { // An error happened. + console.error(error); usr .delete() .then(function () { // User deleted. - showNotification("Name invalid", 2000); + showNotification("An error occured", 2000); $(".pageLogin .preloader").addClass("hidden"); }) .catch(function (error) { @@ -209,7 +215,7 @@ firebase.auth().onAuthStateChanged(function (user) { // showNotification('Applying db config',3000); updateSettingsPage(); saveConfigToCookie(); - } else { + } else if (dbSnapshot.config !== undefined) { let configsDifferent = false; Object.keys(config).forEach((key) => { if (!configsDifferent) {