Changed: modify account urls on client_default_cfg , allow read account manage url from client_default_cfg

merge-requests/7/head
Riasan 3 years ago
parent 405974c9c0
commit 103179ece7

@ -903,17 +903,77 @@ void CClientConfig::setValues()
READ_STRING_FV(FSHost) READ_STRING_FV(FSHost)
READ_BOOL_DEV(DisplayAccountButtons) READ_BOOL_DEV(DisplayAccountButtons)
READ_STRING_DEV(CreateAccountURL)
READ_STRING_DEV(EditAccountURL)
READ_STRING_DEV(ForgetPwdURL) READ_STRING_FV(CreateAccountURL)
READ_STRING_FV(EditAccountURL)
READ_STRING_FV(ForgetPwdURL)
READ_STRING_DEV(BetaAccountURL) READ_STRING_DEV(BetaAccountURL)
READ_STRING_DEV(FreeTrialURL) READ_STRING_DEV(FreeTrialURL)
// defined in client_default.cfg // defined in client_default.cfg
READ_STRING_FV(ConditionsTermsURL)
READ_STRING_FV(NamingPolicyURL)
READ_STRING_FV(LoginSupportURL) READ_STRING_FV(LoginSupportURL)
// read NamingPolicyURL from client_default.cfg
//READ_STRING_FV(NamingPolicyURL)
std::string languageCo = "wk";
CConfigFile::CVar *languageCodeVarPtr = ClientCfg.ConfigFile.getVarPtr("LanguageCode");
if (languageCodeVarPtr)
{
languageCo = languageCodeVarPtr->asString();
}
CConfigFile::CVar *policyurl = ClientCfg.ConfigFile.getVarPtr("NamingPolicyURL");
if (policyurl)
{
for (uint i = 0; i < policyurl->size(); ++i)
{
std::string entry = policyurl->asString(i);
if (entry.size() >= languageCo.size())
{
if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0)
{
std::string::size_type pos = entry.find("=");
if (pos != std::string::npos)
{
ClientCfg.NamingPolicyURL = entry.substr(pos + 1);
}
}
}
}
}
// read NamingPolicyURL from client_default.cfg
//READ_STRING_FV(ConditionsTermsURL)
CConfigFile::CVar *coturl = ClientCfg.ConfigFile.getVarPtr("ConditionsTermsURL");
if (coturl)
{
for (uint i = 0; i < coturl->size(); ++i)
{
std::string entry = coturl->asString(i);
if (entry.size() >= languageCo.size())
{
if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0)
{
std::string::size_type pos = entry.find("=");
if (pos != std::string::npos)
{
ClientCfg.ConditionsTermsURL = entry.substr(pos + 1);
}
}
}
}
}
#ifndef RZ_NO_CLIENT #ifndef RZ_NO_CLIENT
// if cookie is not empty, it means that the client was launch // if cookie is not empty, it means that the client was launch
// by the nel_launcher, so it can't be local // by the nel_launcher, so it can't be local

@ -1932,8 +1932,11 @@ class CAHOpenURL : public IActionHandler
#else #else
// TODO: for Linux and Mac OS // TODO: for Linux and Mac OS
#endif #endif
if (sParams == "cfg_CreateAccountURL")
if (sParams == "cfg_EditAccountURL") {
url = ClientCfg.CreateAccountURL;
}
else if (sParams == "cfg_EditAccountURL")
{ {
url = ClientCfg.EditAccountURL; url = ClientCfg.EditAccountURL;
} }
@ -1972,31 +1975,34 @@ class CAHOpenURL : public IActionHandler
return; return;
} }
// modify existing languages if(sParams != "cfg_ConditionsTermsURL" && sParams != "cfg_NamingPolicyURL")
{
// modify existing languages
// old site // old site
string::size_type pos_lang = url.find("/en/"); string::size_type pos_lang = url.find("/en/");
// or new forums // or new forums
if (pos_lang == string::npos) if (pos_lang == string::npos)
pos_lang = url.find("=en#"); pos_lang = url.find("=en#");
if (pos_lang != string::npos) if (pos_lang != string::npos)
{ {
url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode());
} }
else
{
// append language
if (url.find('?') != string::npos)
url += "&";
else else
url += "?"; {
// append language
if (url.find('?') != string::npos)
url += "&";
else
url += "?";
url += "language=" + ClientCfg.LanguageCode; url += "language=" + ClientCfg.LanguageCode;
if (!LoginCustomParameters.empty()) if (!LoginCustomParameters.empty())
url += LoginCustomParameters; url += LoginCustomParameters;
}
} }
openURL(url); openURL(url);

Loading…
Cancel
Save