mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Fix disable checks.
This commit is contained in:
parent
98835bbc78
commit
246e4e5f4f
@ -30,7 +30,7 @@ export default function Header() {
|
||||
<Link href={isSharePage ? HOMEPAGE_URL : '/'}>umami</Link>
|
||||
</div>
|
||||
<HamburgerButton />
|
||||
{user && (
|
||||
{user && !adminDisabled && (
|
||||
<div className={styles.links}>
|
||||
<Link href="/dashboard">
|
||||
<FormattedMessage id="label.dashboard" defaultMessage="Dashboard" />
|
||||
@ -38,11 +38,9 @@ export default function Header() {
|
||||
<Link href="/realtime">
|
||||
<FormattedMessage id="label.realtime" defaultMessage="Realtime" />
|
||||
</Link>
|
||||
{!adminDisabled && (
|
||||
<Link href="/settings">
|
||||
<FormattedMessage id="label.settings" defaultMessage="Settings" />
|
||||
</Link>
|
||||
)}
|
||||
<Link href="/settings">
|
||||
<FormattedMessage id="label.settings" defaultMessage="Settings" />
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.buttons}>
|
||||
|
@ -24,7 +24,7 @@ export default function App({ Component, pageProps }) {
|
||||
const { basePath } = useRouter();
|
||||
const { dir } = useLocale();
|
||||
|
||||
if (!process.env.uiDisabled) {
|
||||
if (process.env.uiDisabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import Layout from 'components/layout/Layout';
|
||||
import Dashboard from 'components/pages/Dashboard';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
import { useRouter } from 'next/router';
|
||||
import useUser from 'hooks/useUser';
|
||||
import useConfig from 'hooks/useConfig';
|
||||
|
||||
export default function DashboardPage() {
|
||||
const {
|
||||
@ -13,8 +14,9 @@ export default function DashboardPage() {
|
||||
} = useRouter();
|
||||
const { loading } = useRequireLogin();
|
||||
const user = useUser();
|
||||
const { adminDisabled } = useConfig();
|
||||
|
||||
if (!user || !isReady || loading) {
|
||||
if (adminDisabled || !user || !isReady || loading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ export default function LoginPage({ pageDisabled }) {
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!(process.env.DISABLE_LOGIN || process.env.DISABLE_ADMIN),
|
||||
pageDisabled: !!process.env.DISABLE_LOGIN,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user