Client side checking for the client and deactivating actions during sign in request.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13297 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-07-20 15:52:59 +00:00
parent 4a96c67697
commit eafcbc7103

View File

@ -106,8 +106,18 @@ void LoginDialog::login()
{
const stringw username = m_username_widget->getText().trim();
const stringw password = m_password_widget->getText().trim();
m_sign_in_request = Online::CurrentUser::acquire()->requestSignIn(username,password, m_remember_widget->getState());
Online::CurrentUser::release();
if (username.size() < 4 || username.size() > 30 || password.size() < 8 || password.size() > 30)
{
sfx_manager->quickSound("anvil");
m_info_widget->setErrorColor();
m_info_widget->setText(_("Username and/or password invalid."), false);
}
else
{
m_options_widget->setDeactivated();
m_sign_in_request = Online::CurrentUser::acquire()->requestSignIn(username,password, m_remember_widget->getState());
Online::CurrentUser::release();
}
}
// -----------------------------------------------------------------------------
@ -145,7 +155,8 @@ void LoginDialog::onEnterPressedInternal()
const int playerID = PLAYER_ID_GAME_MASTER;
if (GUIEngine::isFocusedForPlayer(m_options_widget, playerID))
return;
login();
if (m_sign_in_widget->isActivated())
login();
}
// -----------------------------------------------------------------------------
@ -166,6 +177,7 @@ void LoginDialog::onUpdate(float dt)
m_info_widget->setErrorColor();
m_info_widget->setText(m_sign_in_request->getInfo(), false);
}
m_options_widget->setActivated();
delete m_sign_in_request;
m_sign_in_request = NULL;
}