|
|
|
@ -842,6 +842,55 @@ void initAutoLogin()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initAltLogin()
|
|
|
|
|
{
|
|
|
|
|
// Check the alt param
|
|
|
|
|
if (!LoginCustomParameters.empty())
|
|
|
|
|
{
|
|
|
|
|
// don't use login and password for alternate login
|
|
|
|
|
string res = checkLogin("", "", ClientApp, LoginCustomParameters);
|
|
|
|
|
if (res.empty())
|
|
|
|
|
{
|
|
|
|
|
if (ClientCfg.R2Mode)
|
|
|
|
|
{
|
|
|
|
|
LoginSM.pushEvent(CLoginStateMachine::ev_login_ok);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Select good shard
|
|
|
|
|
ShardSelected = -1;
|
|
|
|
|
for (uint32 i = 0; i < Shards.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (Shards[i].ShardId == LoginShardId)
|
|
|
|
|
{
|
|
|
|
|
ShardSelected = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ShardSelected == -1)
|
|
|
|
|
{
|
|
|
|
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
|
pIM->messageBoxWithHelp(CI18N::get("uiErrServerLost"), "ui:login");
|
|
|
|
|
LoginSM.pushEvent(CLoginStateMachine::ev_quit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LoginSM.pushEvent(CLoginStateMachine::ev_login_ok);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// close the socket in case of error
|
|
|
|
|
HttpClient.disconnect();
|
|
|
|
|
|
|
|
|
|
// ignore error
|
|
|
|
|
LoginSM.pushEvent(CLoginStateMachine::ev_login_not_alt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
// Called from client.cpp
|
|
|
|
@ -2732,6 +2781,9 @@ string checkLogin(const string &login, const string &password, const string &cli
|
|
|
|
|
|
|
|
|
|
string res;
|
|
|
|
|
|
|
|
|
|
// don't use login with alt method
|
|
|
|
|
if (!login.empty())
|
|
|
|
|
{
|
|
|
|
|
// ask server for salt
|
|
|
|
|
if(!HttpClient.sendGet(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?cmd=ask&login="+login+"&lg="+ClientCfg.LanguageCode, "", pPM->isVerboseLog()))
|
|
|
|
|
return "Can't send (error code 60)";
|
|
|
|
@ -2768,13 +2820,24 @@ string checkLogin(const string &login, const string &password, const string &cli
|
|
|
|
|
return "Can't connect (error code 63)";
|
|
|
|
|
|
|
|
|
|
if(pPM->isVerboseLog()) nlinfo("Connected");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ClientCfg.R2Mode)
|
|
|
|
|
{
|
|
|
|
|
// R2 login sequence
|
|
|
|
|
|
|
|
|
|
if (!login.empty())
|
|
|
|
|
{
|
|
|
|
|
std::string cryptedPassword = CCrypt::crypt(password, Salt);
|
|
|
|
|
if(!HttpClient.sendGet(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?cmd=login&login="+login+"&password="+cryptedPassword+"&clientApplication="+clientApp+"&cp=1"+"&lg="+ClientCfg.LanguageCode+customParameters))
|
|
|
|
|
return "Can't send (error code 2)";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// don't send login and password if empty
|
|
|
|
|
if(!HttpClient.sendGet(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?cmd=login&clientApplication="+clientApp+"&cp=1"+"&lg="+ClientCfg.LanguageCode+customParameters))
|
|
|
|
|
return "Can't send (error code 2)";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the response should contains the result code and the cookie value
|
|
|
|
|
if(pPM->isVerboseLog()) nlinfo("Sent request login check");
|
|
|
|
|