summaryrefslogtreecommitdiffstats
path: root/src/WebAdmin.cpp
diff options
context:
space:
mode:
authorNiLSPACE <NiLSPACE@users.noreply.github.com>2023-05-25 09:34:39 +0200
committerGitHub <noreply@github.com>2023-05-25 09:34:39 +0200
commit17d5278d593d93a331b79dcf68c60face33b6d7a (patch)
treefb50cb58d2b4a909343921bd66569b80f119435a /src/WebAdmin.cpp
parentUpdated LTO Check to new standard. (#5476) (diff)
downloadcuberite-17d5278d593d93a331b79dcf68c60face33b6d7a.tar
cuberite-17d5278d593d93a331b79dcf68c60face33b6d7a.tar.gz
cuberite-17d5278d593d93a331b79dcf68c60face33b6d7a.tar.bz2
cuberite-17d5278d593d93a331b79dcf68c60face33b6d7a.tar.lz
cuberite-17d5278d593d93a331b79dcf68c60face33b6d7a.tar.xz
cuberite-17d5278d593d93a331b79dcf68c60face33b6d7a.tar.zst
cuberite-17d5278d593d93a331b79dcf68c60face33b6d7a.zip
Diffstat (limited to 'src/WebAdmin.cpp')
-rw-r--r--src/WebAdmin.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index 39b935fbd..775dc1860 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -190,6 +190,13 @@ void cWebAdmin::Reload(void)
" This will not take effect until you restart the server."
);
}
+ else if (!HasUsers())
+ {
+ LOGWARNING(
+ "The webadmin is enabled but has no users configured."
+ " To add new users, edit webadmin.ini"
+ );
+ }
// Initialize the WebAdmin template script and reload the file:
if (m_TemplateScript.IsValid())
@@ -248,6 +255,23 @@ bool cWebAdmin::LoadIniFile(void)
+bool cWebAdmin::HasUsers()
+{
+ for (int i = 0; i < m_IniFile.GetNumKeys(); i++)
+ {
+ AString key = m_IniFile.GetKeyName(i);
+ if (key.rfind("User:", 0) == 0)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
void cWebAdmin::HandleWebadminRequest(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request)
{
if (!a_Request.HasAuth())