X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e3e39cff57129ed71935bd0016e16bc134742872..e3c5fe3cce7be5d2b48bfcf11a1de20ca12fc7e0:/projects/stargazer/user_impl.cpp diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index 36930576..72a3378f 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -557,6 +557,8 @@ if (authorizedBy.empty()) lastDisconnectReason = reason; lastIPForDisconnect = currIP; currIP = 0; // DelUser in traffcounter + if (connected) + Disconnect(false, "not authorized"); return; } } @@ -1176,10 +1178,24 @@ if (nextTariff.ConstData() != "") { const TARIFF * nt = tariffs->FindByName(nextTariff); if (nt == NULL) + { WriteServLog("Cannot change tariff for user %s. Tariff %s not exist.", login.c_str(), property.tariffName.Get().c_str()); + } else - property.tariffName.Set(nextTariff, sysAdmin, login, store); + { + if (tariff->TariffChangelsAllowed(*nt) == "") + { + property.tariffName.Set(nextTariff, sysAdmin, login, store); + } + else + { + std::string message = tariff->TariffChangelsAllowed(*nt); + WriteServLog("Tariff change is prohibited for user %s. %s", + login.c_str(), + message.c_str()); + } + } ResetNextTariff(); WriteConf(); }