Ticket #3575: prelobby.js.patch

File prelobby.js.patch, 4.3 KB (added by Imarok, 3 years ago)

some stylefixes

  • binaries/data/mods/public/gui/lobby/prelobby.js

     
    11var g_LobbyIsConnecting = false;
    2 var g_EncrytedPassword = "";
     2var g_EncryptedPassword = "";
    33var g_PasswordInputIsHidden = false;
    44var g_TermsOfServiceRead = false;
    55var g_TermsOfUseRead = false;
     
    77
    88function init()
    99{
    10     g_EncrytedPassword = Engine.ConfigDB_GetValue("user", "lobby.password");
    11     if (Engine.ConfigDB_GetValue("user", "lobby.login") && g_EncrytedPassword)
     10    g_EncryptedPassword = Engine.ConfigDB_GetValue("user", "lobby.password");
     11    if (Engine.ConfigDB_GetValue("user", "lobby.login") && g_EncryptedPassword)
    1212        switchPage("connect");
    1313}
    1414
     
    3939
    4040    feedback.caption = translate("Connecting...");
    4141    // If they enter a different password, re-encrypt.
    42     if (password != g_EncrytedPassword.substring(0, 10))
    43         g_EncrytedPassword = Engine.EncryptPassword(password, username);
     42    if (password != g_EncryptedPassword.substring(0, 10))
     43        g_EncryptedPassword = Engine.EncryptPassword(password, username);
    4444    // We just use username as nick for simplicity.
    45     Engine.StartXmppClient(username, g_EncrytedPassword, room, username, history);
     45    Engine.StartXmppClient(username, g_EncryptedPassword, room, username, history);
    4646    g_LobbyIsConnecting = true;
    4747    Engine.ConnectXmppClient();
    4848}
     
    6060    var feedback = Engine.GetGUIObjectByName("feedback");
    6161
    6262    feedback.caption = translate("Registering...");
    63     g_EncrytedPassword = Engine.EncryptPassword(password, account);
    64     Engine.StartRegisterXmppClient(account, g_EncrytedPassword);
     63    g_EncryptedPassword = Engine.EncryptPassword(password, account);
     64    Engine.StartRegisterXmppClient(account, g_EncryptedPassword);
    6565    g_LobbyIsConnecting = true;
    6666    Engine.ConnectXmppClient();
    6767}
     
    6868
    6969function onTick()
    7070{
    71     var pageRegisterHidden = Engine.GetGUIObjectByName("pageRegister").hidden;
    72     var username = Engine.GetGUIObjectByName(pageRegisterHidden ? "connectUsername" : "registerUsername").caption;
    73     var password = Engine.GetGUIObjectByName(pageRegisterHidden ? "connectPassword" : "registerPassword").caption;
    74     var passwordAgain = Engine.GetGUIObjectByName("registerPasswordAgain").caption;
     71    let pageRegisterHidden = Engine.GetGUIObjectByName("pageRegister").hidden;
     72    let username = Engine.GetGUIObjectByName(pageRegisterHidden ? "connectUsername" : "registerUsername").caption;
     73    let password = Engine.GetGUIObjectByName(pageRegisterHidden ? "connectPassword" : "registerPassword").caption;
     74    let passwordAgain = Engine.GetGUIObjectByName("registerPasswordAgain").caption;
    7575
    76     var agreeTerms = Engine.GetGUIObjectByName("registerAgreeTerms");
    77     var feedback = Engine.GetGUIObjectByName("feedback");
    78     var continueButton = Engine.GetGUIObjectByName("continue");
     76    let agreeTerms = Engine.GetGUIObjectByName("registerAgreeTerms");
     77    let feedback = Engine.GetGUIObjectByName("feedback");
     78    let continueButton = Engine.GetGUIObjectByName("continue");
    7979
    8080    // Do not change feedback while connecting.
    8181    if (g_LobbyIsConnecting) {}
     
    149149    }
    150150
    151151    // Handle queued messages from the XMPP client (if running and if any)
    152     var message;
     152    let message;
    153153    while ((message = Engine.LobbyGuiPollMessage()) != undefined)
    154154    {
    155155        // TODO: Properly deal with unrecognized messages
     
    184184            Engine.ConfigDB_CreateValue("user", "lobby.login", username);
    185185            Engine.ConfigDB_WriteValueToFile("user", "lobby.login", username, "config/user.cfg");
    186186            // We only store the encrypted password, so make sure to re-encrypt it if changed before saving.
    187             if (password != g_EncrytedPassword.substring(0, 10))
    188                 g_EncrytedPassword = Engine.EncryptPassword(password, username);
    189             Engine.ConfigDB_CreateValue("user", "lobby.password", g_EncrytedPassword);
    190             Engine.ConfigDB_WriteValueToFile("user", "lobby.password", g_EncrytedPassword, "config/user.cfg");
     187            if (password != g_EncryptedPassword.substring(0, 10))
     188                g_EncryptedPassword = Engine.EncryptPassword(password, username);
     189            Engine.ConfigDB_CreateValue("user", "lobby.password", g_EncryptedPassword);
     190            Engine.ConfigDB_WriteValueToFile("user", "lobby.password", g_EncryptedPassword, "config/user.cfg");
    191191            break;
    192192        }
    193193        }