added protection

This commit is contained in:
Miodec 2022-05-13 09:54:52 +02:00
parent cc004de147
commit d38f739c63

View file

@ -404,19 +404,23 @@ export async function addGoogleAuth(): Promise<void> {
export function noGoogleNoMo(): void {
const user = Auth.currentUser;
if (user === null) return;
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
);
});
if (
user.providerData.find((provider) => provider.providerId === "password")
) {
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
);
});
}
}
export async function removeGoogleAuth(): Promise<void> {