diff --git a/frontend/src/js/controllers/account-controller.js b/frontend/src/js/controllers/account-controller.js index ba574d647..e296ba6e3 100644 --- a/frontend/src/js/controllers/account-controller.js +++ b/frontend/src/js/controllers/account-controller.js @@ -44,7 +44,10 @@ async function loadUser(user) { PageTransition.set(false); AccountButton.update(); AccountButton.loading(true); - await Account.getDataAndInit(); + if ((await Account.getDataAndInit()) == false) { + console.log("Signing out!"); + signOut(); + } // var displayName = user.displayName; // var email = user.email; // var emailVerified = user.emailVerified; @@ -564,3 +567,7 @@ $(".pageSettings #addGoogleAuth").on("click", async (e) => { $(".pageSettings #removeGoogleAuth").on("click", (e) => { removeGoogleAuth(); }); + +$(document).on("click", ".pageAccount .sendVerificationEmail", (event) => { + sendVerificationEmail(); +}); diff --git a/frontend/src/js/index.js b/frontend/src/js/index.js index cbf44ef34..caaea685a 100644 --- a/frontend/src/js/index.js +++ b/frontend/src/js/index.js @@ -10,6 +10,7 @@ Chart.plugins.register(chartAnnotation); import * as DB from "./db"; import * as Misc from "./misc"; +import "./controllers/account-controller"; import Config from "./config"; import { enable } from "./states/glarses-mode"; import "./test/caps-warning"; diff --git a/frontend/src/js/pages/account.js b/frontend/src/js/pages/account.js index 73bee1167..6922d24f2 100644 --- a/frontend/src/js/pages/account.js +++ b/frontend/src/js/pages/account.js @@ -16,7 +16,6 @@ import * as ResultTagsPopup from "../popups/result-tags-popup"; import * as Settings from "./settings"; import * as AllTimeStats from "../account/all-time-stats"; import * as PbTables from "../account/pb-tables"; -import * as AccountController from "../controllers/account-controller"; import * as LoadingPage from "./loading"; import * as Focus from "../test/focus"; import * as SignOutButton from "../account/sign-out-button"; @@ -67,8 +66,7 @@ export async function getDataAndInit() { // $("#top #menu .account .icon").html(''); $("#top #menu .account").css("opacity", 1); if (ActivePage.get() == "loading") PageController.change(""); - AccountController.signOut(); - return; + return false; } if (ActivePage.get() == "loading") { LoadingPage.updateBar(100); @@ -139,8 +137,7 @@ export async function getDataAndInit() { ); if (name == null) { - AccountController.signOut(); - return; + return false; } let response; @@ -1200,10 +1197,6 @@ $(document).on("click", ".pageAccount .miniResultChartButton", (event) => { ); }); -$(document).on("click", ".pageAccount .sendVerificationEmail", (event) => { - AccountController.sendVerificationEmail(); -}); - $(document).on("click", ".history-wpm-header", (event) => { sortAndRefreshHistory("wpm", ".history-wpm-header"); });