mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-04 21:09:18 +08:00
fixed name change when logged in with google
This commit is contained in:
parent
cc1ccf6d9a
commit
3b6fb2d3b3
1 changed files with 18 additions and 10 deletions
|
@ -64,18 +64,30 @@ class SimplePopup {
|
|||
if (this.type === "number") {
|
||||
this.inputs.forEach((input) => {
|
||||
el.find(".inputs").append(`
|
||||
<input type="number" min="1" val="${input.initVal}" placeholder="${input.placeholder}" required autocomplete="off">
|
||||
<input type="number" min="1" val="${input.initVal}" placeholder="${
|
||||
input.placeholder
|
||||
}" class="${input.hidden ? "hidden" : ""}" ${
|
||||
input.hidden ? "" : "required"
|
||||
} autocomplete="off">
|
||||
`);
|
||||
});
|
||||
} else if (this.type === "text") {
|
||||
this.inputs.forEach((input) => {
|
||||
if (input.type) {
|
||||
el.find(".inputs").append(`
|
||||
<input type="${input.type}" val="${input.initVal}" placeholder="${input.placeholder}" required autocomplete="off">
|
||||
<input type="${input.type}" val="${input.initVal}" placeholder="${
|
||||
input.placeholder
|
||||
}" class="${input.hidden ? "hidden" : ""}" ${
|
||||
input.hidden ? "" : "required"
|
||||
} autocomplete="off">
|
||||
`);
|
||||
} else {
|
||||
el.find(".inputs").append(`
|
||||
<input type="text" val="${input.initVal}" placeholder="${input.placeholder}" required autocomplete="off">
|
||||
<input type="text" val="${input.initVal}" placeholder="${
|
||||
input.placeholder
|
||||
}" class="${input.hidden ? "hidden" : ""}" ${
|
||||
input.hidden ? "" : "required"
|
||||
} autocomplete="off">
|
||||
`);
|
||||
}
|
||||
});
|
||||
|
@ -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"`);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue