Skip to content

Commit 04f8e16

Browse files
author
Pavlo Kulyk
committed
fix: update Sidebar component to check for localhost instead of private IP
1 parent b8c330d commit 04f8e16

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

adminforth/modules/restApi.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
382382
if (username === 'adminforth') {
383383
defaultUserExists = true;
384384
}
385-
const clientIp = this.adminforth.auth.getClientIp(response.getHeaders?.() || {});
386-
const isPrivateIP = is_ip_private(clientIp);
387385

388386
const publicPart = {
389387
brandName: this.adminforth.config.customization.brandName,
@@ -414,7 +412,6 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
414412
userFullnameField: this.adminforth.config.auth.userFullNameField,
415413
settingPages: settingPages,
416414
defaultUserExists: defaultUserExists,
417-
isPrivateIP: isPrivateIP,
418415
}
419416

420417
// translate menu labels

adminforth/spa/src/components/Sidebar.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</div>
5252
</div>
5353

54-
<div v-if="coreStore.config.defaultUserExists && !coreStore.config.isPrivateIP" class="p-4 mb-4 text-white rounded-lg bg-red-700/80 fill-white text-sm">
54+
<div v-if="coreStore.config.defaultUserExists && !isLocalhost" class="p-4 mb-4 text-white rounded-lg bg-red-700/80 fill-white text-sm">
5555
<IconExclamationCircleOutline class="inline-block align-text-bottom mr-0,5 w-5 h-5" />
5656
Default user <strong>"adminforth"</strong> detected. Delete it and create your own account.
5757
</div>
@@ -307,6 +307,8 @@ import type { AnnouncementBadgeResponse } from '@/types/Common';
307307
import { useAdminforth } from '@/adminforth';
308308
import { IconExclamationCircleOutline} from '@iconify-prerendered/vue-flowbite';
309309
310+
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1' || window.location.hostname === '::1';
311+
310312
const { menu } = useAdminforth();
311313
312314
interface Props {

0 commit comments

Comments
 (0)