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 <bartnikjack@gmail.com>
This commit is contained in:
Aleksandr Sajenko 2021-08-29 19:44:11 +03:00 committed by GitHub
parent 58dd2aa097
commit 0a9f9580f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -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 });

View file

@ -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 });