removed function to remove google auth through the console

This commit is contained in:
Miodec 2022-05-29 14:34:28 +02:00
parent bb5886f3a7
commit 8f28a9c04b
2 changed files with 0 additions and 60 deletions

View file

@ -38,7 +38,6 @@ import {
linkWithPopup,
linkWithCredential,
reauthenticateWithPopup,
unlink as unlinkAuth,
getAdditionalUserInfo,
sendPasswordResetEmail,
User as UserType,
@ -409,58 +408,6 @@ export async function addGoogleAuth(): Promise<void> {
});
}
export function noGoogleNoMo(): void {
const user = Auth.currentUser;
if (user === null) return;
if (
user.providerData.find((provider) => provider.providerId === "password")
) {
unlinkAuth(user, "google.com")
.then(() => {
console.log("unlinked");
Settings.updateAuthSections();
})
.catch((error) => {
console.log(error);
});
}
}
export async function removeGoogleAuth(): Promise<void> {
const user = Auth.currentUser;
if (user === null) return;
if (
user.providerData.find((provider) => provider.providerId === "password")
) {
Loader.show();
try {
await reauthenticateWithPopup(user, gmailProvider);
} catch (e) {
Loader.hide();
const message = Misc.createErrorMessage(e, "Failed to reauthenticate");
return Notifications.add(message, -1);
}
unlinkAuth(user, "google.com")
.then(() => {
Notifications.add("Google authentication removed", 1);
Loader.hide();
Settings.updateAuthSections();
})
.catch((error) => {
Loader.hide();
Notifications.add(
"Failed to remove Google authentication: " + error.message,
-1
);
});
} else {
Notifications.add(
"Password authentication needs to be enabled to remove Google authentication",
-1
);
}
}
export async function addPasswordAuth(
email: string,
password: string
@ -710,10 +657,6 @@ $(".pageSettings #addGoogleAuth").on("click", async () => {
addGoogleAuth();
});
$(".pageSettings #removeGoogleAuth").on("click", () => {
removeGoogleAuth();
});
$(document).on("click", ".pageAccount .sendVerificationEmail", () => {
sendVerificationEmail();
});

View file

@ -28,7 +28,6 @@ import "./popups/mobile-test-config-popup";
import "./popups/edit-tags-popup";
import "./popups/google-sign-up-popup";
import * as Account from "./pages/account";
import { noGoogleNoMo } from "./controllers/account-controller";
import "./elements/leaderboards";
type ExtendedGlobal = typeof globalThis & MonkeyTypes.Global;
@ -54,5 +53,3 @@ extendedGlobal.getTimerStats = TestTimer.getTimerStats;
extendedGlobal.toggleUnsmoothedRaw = Result.toggleUnsmoothedRaw;
extendedGlobal.enableSpacingDebug = TestInput.enableSpacingDebug;
extendedGlobal.noGoogleNoMo = noGoogleNoMo;