Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Moved DISABLE_LOGIN check to getServerSideProps.

Mike Cao68d35c0fc49b
diff --git a/next.config.js b/next.config.js
index b5e4b8065..d6a953fcb 100644
--- a/next.config.js
+++ b/next.config.js
@@ -35,9 +35,6 @@ if (process.env.FORCE_SSL) {
module.exports = {
env: {
currentVersion: pkg.version,
- loginDisabled: process.env.DISABLE_LOGIN,
- updatesDisabled: process.env.DISABLE_UPDATES,
- telemetryDisabled: process.env.DISABLE_TELEMETRY,
},
basePath: process.env.BASE_PATH,
output: 'standalone',
diff --git a/pages/login.js b/pages/login.js
index 94c0df640..4856a7725 100644
--- a/pages/login.js
+++ b/pages/login.js
@@ -2,8 +2,8 @@ import React from 'react';
import Layout from 'components/layout/Layout';
import LoginForm from 'components/forms/LoginForm';
-export default function LoginPage() {
- if (process.env.loginDisabled) {
+export default function LoginPage({ loginDisabled }) {
+ if (loginDisabled) {
return null;
}
@@ -13,3 +13,9 @@ export default function LoginPage() {
</Layout>
);
}
+
+export async function getServerSideProps() {
+ return {
+ props: { loginDisabled: !!process.env.DISABLE_LOGIN },
+ };
+}