From 0a9f9580f4aea78c031b1ea5f586adb70044c296 Mon Sep 17 00:00:00 2001 From: Aleksandr Sajenko Date: Sun, 29 Aug 2021 19:44:11 +0300 Subject: [PATCH] Add exit condition for username loop (#1779) by alex-1121 * Add exit condition for username loop Sign out if username prompt is closed. * hiding preloader Co-authored-by: Jack --- src/js/account-controller.js | 7 +++++++ src/js/account.js | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/js/account-controller.js b/src/js/account-controller.js index e92b15e89..b34f92bfc 100644 --- a/src/js/account-controller.js +++ b/src/js/account-controller.js @@ -2,6 +2,7 @@ import * as Notifications from "./notifications"; import * as UpdateConfig from "./config"; import * as AccountButton from "./account-button"; import * as Account from "./account"; +import * as AccountController from "./account-controller"; import * as CommandlineLists from "./commandline-lists"; import * as VerificationController from "./verification-controller"; import * as Misc from "./misc"; @@ -121,6 +122,12 @@ export async function signInWithGoogle() { "Please provide a new username (cannot be longer than 16 characters, can only contain letters, numbers, underscores, dots and dashes):" ); + if (name == null) { + AccountController.signOut(); + $(".pageLogin .preloader").addClass("hidden"); + return; + } + let response; try { response = await axiosInstance.post("/user/checkName", { name }); diff --git a/src/js/account.js b/src/js/account.js index 025041ded..529da30f5 100644 --- a/src/js/account.js +++ b/src/js/account.js @@ -93,6 +93,11 @@ export async function getDataAndInit() { "Please provide a new username (cannot be longer than 16 characters, can only contain letters, numbers, underscores, dots and dashes):" ); + if (name == null) { + AccountController.signOut(); + return; + } + let response; try { response = await axiosInstance.post("/user/updateName", { name });