I was able to simplify the login code too. ctdl_startup() is now called at landing...
authorArt Cancro <ajc@citadel.org>
Sat, 15 Jan 2022 20:41:53 +0000 (15:41 -0500)
committerArt Cancro <ajc@citadel.org>
Sat, 15 Jan 2022 20:41:53 +0000 (15:41 -0500)
webcit-ng/static/js/login.js

index bf2216b8f5402971009f11b84857c64d01325235..6754e7447011d3445e15d4da49d5412c32ea892b 100644 (file)
@@ -36,9 +36,8 @@ function display_login_screen(any_message) {
 // When we go back to ctdl_startup() it will detect that we are no longer logged in, and do the right thing.
 //function logout() {
 logout = async() => {
-
        response = await fetch("/ctdl/a/logout");
-       ctdl_startup();
+       ctdl_startup();                                 // let the regular startup code take care of everything else
 }
 
 
@@ -62,11 +61,8 @@ function login_button(username) {
 
 function login_result(data) {
        if (data.substring(0,1) == "2") {
-               logged_in = 1;
-               current_user = data.substring(4).split("|")[0];
-               update_banner();
-               document.getElementById("ctdl-main").innerHTML = "FIXME ok we are logged in as " + current_user + " ... " ;
                document.getElementById("ctdl_big_modal").style.display = "none";
+               ctdl_startup();                         // let the regular startup code take care of everything else
        }
        else {
                display_login_screen(data.substring(4));