Fix login options not dynamically reading ALLOW_REGISTRATION
continuous-integration/drone/push Build is passing Details

main
Guus van Meerveld 2 years ago
parent f91fe471b7
commit 9c7548625b

@ -1,4 +1,4 @@
NEXT_PUBLIC_GITEA_USERNAME=Guusvanmeerveld
NEXT_PUBLIC_GITEA_SERVER=git.guusvanmeerveld.dev
DATABASE_URL=postgresql://portfolio:portfolio@localhost:5432/portfolio?schema=public
# ALLOW_REGISTRATION=true
# NEXT_PUBLIC_ALLOW_REGISTRATION=true

@ -1,4 +1,4 @@
import { GetStaticProps, NextPage } from "next";
import { GetServerSideProps, NextPage } from "next";
import { NextSeo } from "next-seo";
import Layout from "@components/Layout";
@ -8,7 +8,9 @@ import multipleClassNames from "@utils/multipleClassNames";
import styles from "./login.module.scss";
import { registrationIsEnabled } from "@utils/config";
const Login: NextPage = () => {
const Login: NextPage<{ registrationEnabled: boolean }> = ({
registrationEnabled
}) => {
return (
<Layout>
<NextSeo title="Login" />
@ -16,7 +18,7 @@ const Login: NextPage = () => {
<div className="columns">
<div
className={`col-md-4 ${
registrationIsEnabled ? "col-ml-auto" : "col-mx-auto"
registrationEnabled ? "col-ml-auto" : "col-mx-auto"
}`}
>
<h2 className={styles.title}>Login to blog</h2>
@ -61,7 +63,7 @@ const Login: NextPage = () => {
</div>
</form>
</div>
{registrationIsEnabled && (
{registrationEnabled && (
<>
<div
className={multipleClassNames("divider-vert", styles.divider)}
@ -128,4 +130,8 @@ const Login: NextPage = () => {
);
};
export const getServerSideProps: GetServerSideProps = async () => {
return { props: { registrationEnabled: registrationIsEnabled } };
};
export default Login;

Loading…
Cancel
Save