From 5d4a3700ed9f35c0823e1db2f55113f68161fcf2 Mon Sep 17 00:00:00 2001 From: in1tiate Date: Tue, 9 Mar 2021 13:32:08 -0600 Subject: [PATCH] config bg lock, fail if modpass is empty --- src/area_data.cpp | 2 +- src/commands.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/area_data.cpp b/src/area_data.cpp index a2d9373..0036af3 100644 --- a/src/area_data.cpp +++ b/src/area_data.cpp @@ -28,13 +28,13 @@ AreaData::AreaData(QStringList characters, QString p_name, int p_index) areas_ini.beginGroup(p_name); background = areas_ini.value("background", "gs4").toString(); is_protected = areas_ini.value("protected_area").toBool(); + bg_locked = areas_ini.value("bg_locked", "false").toBool(); areas_ini.endGroup(); player_count = 0; locked = FREE; status = "FREE"; def_hp = 10; pro_hp = 10; - bg_locked = false; document = "No document."; QSettings config_ini("config/config.ini", QSettings::IniFormat); config_ini.beginGroup("Options"); diff --git a/src/commands.cpp b/src/commands.cpp index 6abee2f..dcbacf0 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -37,12 +37,15 @@ void AOClient::cmdLogin(int argc, QStringList argv) return; } - // TODO: tell the user if no modpass is set if (auth_type == "simple") { - if(argv[0] == modpass) { + if (modpass == "") { + sendServerMessage("No modpass is set! Please set a modpass before authenticating."); + } + else if(argv[0] == modpass) { sendServerMessage("Logged in as a moderator."); // This string has to be exactly this, because it is hardcoded in the client authenticated = true; - } else { + } + else { sendServerMessage("Incorrect password."); } server->areas.value(current_area)->logger->logLogin(this, authenticated, "moderator"); @@ -181,8 +184,6 @@ void AOClient::cmdSetRootPass(int argc, QStringList argv) void AOClient::cmdSetBackground(int argc, QStringList argv) { - // TODO: area locks in areas.ini - // TODO: sendServerMessage but area broadcast AreaData* area = server->areas[current_area]; if (authenticated || !area->bg_locked) { if (server->backgrounds.contains(argv[0])) {