forked from mirrors/0ad
bf0034f694
The `onTick` of the register-page was still running when connecting to
the lobby. This lead to an error when the `connect` message was
received.
With this commit returning from the login-page will always return to the
entrance-page. Previously it returned to the register-page when it was
opened by through that page.
(cherry picked from commit 0b83e24065)
Signed-off-by: phosit <phosit@autistici.org>
45 lines
827 B
JavaScript
45 lines
827 B
JavaScript
function init()
|
|
{
|
|
Engine.GetGUIObjectByName("continue").caption = translate("Register");
|
|
|
|
initLobbyTerms();
|
|
|
|
initRememberPassword();
|
|
|
|
updateFeedback();
|
|
|
|
return Promise.race([ onRegistered(), cancelButton() ]);
|
|
}
|
|
|
|
function updateFeedback()
|
|
{
|
|
setFeedback(checkUsername(true) || checkPassword(true) || checkPasswordConfirmation() || checkTerms());
|
|
}
|
|
|
|
function onUsernameEdit()
|
|
{
|
|
updateFeedback();
|
|
}
|
|
|
|
function continueButton()
|
|
{
|
|
setFeedback(translate("Registering…"));
|
|
|
|
Engine.StartRegisterXmppClient(
|
|
Engine.GetGUIObjectByName("username").caption,
|
|
getEncryptedPassword());
|
|
|
|
Engine.ConnectXmppClient();
|
|
}
|
|
|
|
async function onRegistered()
|
|
{
|
|
await new Promise(resolve => { g_LobbyMessages.registered = resolve; });
|
|
saveCredentials();
|
|
|
|
setFeedback(translate("Registered"));
|
|
|
|
Engine.StopXmppClient();
|
|
return true;
|
|
}
|