From 4c67998f128367f229767a2fb217fd14925556aa Mon Sep 17 00:00:00 2001 From: Pavlo Kulyk Date: Fri, 30 Jan 2026 15:38:30 +0200 Subject: [PATCH] feat: add default user detection and private IP check to AdminForthRestAPI --- adminforth/modules/restApi.ts | 10 ++++++++++ adminforth/spa/src/components/Sidebar.vue | 6 ++++++ adminforth/types/Common.ts | 1 + 3 files changed, 17 insertions(+) diff --git a/adminforth/modules/restApi.ts b/adminforth/modules/restApi.ts index 78a8c946..f4ddc332 100644 --- a/adminforth/modules/restApi.ts +++ b/adminforth/modules/restApi.ts @@ -376,6 +376,14 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { } } + let defaultUserExists = false; + if (username === 'adminforth') { + defaultUserExists = true; + } + const headers = response.getHeaders?.() || {}; + const clientIp = this.adminforth.auth.getClientIp(headers); + const isPrivateIP = clientIp === null ? true :false; + const publicPart = { brandName: this.adminforth.config.customization.brandName, usernameFieldName: usernameColumn.label, @@ -404,6 +412,8 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { globalInjections: this.adminforth.config.customization.globalInjections, userFullnameField: this.adminforth.config.auth.userFullNameField, settingPages: settingPages, + defaultUserExists: defaultUserExists, + isPrivateIP: isPrivateIP, } // translate menu labels diff --git a/adminforth/spa/src/components/Sidebar.vue b/adminforth/spa/src/components/Sidebar.vue index 2881f182..0c9ade0b 100644 --- a/adminforth/spa/src/components/Sidebar.vue +++ b/adminforth/spa/src/components/Sidebar.vue @@ -51,6 +51,11 @@ +
+ + Default user "adminforth" detected. Delete it and create your own account. +
+