From 3b6fb2d3b3bfb4e822db210f0183ed89fcf1b5a6 Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 23 Sep 2021 15:06:05 +0100 Subject: [PATCH] fixed name change when logged in with google --- src/js/simple-popups.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/js/simple-popups.js b/src/js/simple-popups.js index 773ac967b..4c6cafba7 100644 --- a/src/js/simple-popups.js +++ b/src/js/simple-popups.js @@ -64,18 +64,30 @@ class SimplePopup { if (this.type === "number") { this.inputs.forEach((input) => { el.find(".inputs").append(` - + `); }); } else if (this.type === "text") { this.inputs.forEach((input) => { if (input.type) { el.find(".inputs").append(` - + `); } else { el.find(".inputs").append(` - + `); } }); @@ -254,6 +266,8 @@ list.updateName = new SimplePopup( pass ); await user.reauthenticateWithCredential(credential); + } else if (user.providerData[0].providerId === "google.com") { + await user.reauthenticateWithPopup(AccountController.gmailProvider); } Loader.show(); @@ -304,13 +318,7 @@ list.updateName = new SimplePopup( () => { const user = firebase.auth().currentUser; if (user.providerData[0].providerId === "google.com") { - eval(`this.inputs = [ - { - placeholder: "New name", - type: "text", - initVal: "", - }, - ]`); + eval(`this.inputs[0].hidden = true`); eval(`this.buttonText = "Reauthenticate to update"`); } }