|
@@ -10,6 +10,7 @@ import dynamic from 'next/dynamic';
|
|
|
import Head from 'next/head';
|
|
import Head from 'next/head';
|
|
|
|
|
|
|
|
import { NoLoginLayout } from '~/components/Layout/NoLoginLayout';
|
|
import { NoLoginLayout } from '~/components/Layout/NoLoginLayout';
|
|
|
|
|
+import type { CrowiRequest } from '~/interfaces/crowi-request';
|
|
|
|
|
|
|
|
import InstallerForm from '../components/InstallerForm';
|
|
import InstallerForm from '../components/InstallerForm';
|
|
|
import {
|
|
import {
|
|
@@ -31,10 +32,18 @@ async function injectNextI18NextConfigurations(context: GetServerSidePropsContex
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type Props = CommonProps & {
|
|
type Props = CommonProps & {
|
|
|
-
|
|
|
|
|
|
|
+ minPasswordLength: number,
|
|
|
pageWithMetaStr: string,
|
|
pageWithMetaStr: string,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+type TextFormProps = {
|
|
|
|
|
+ username: string,
|
|
|
|
|
+}
|
|
|
|
|
+const TextForm = (props: TextFormProps): JSX.Element => {
|
|
|
|
|
+ return <>{props.username}</>;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const InstallerPage: NextPage<Props> = (props: Props) => {
|
|
const InstallerPage: NextPage<Props> = (props: Props) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const { t: tCommons } = useTranslation('commons');
|
|
const { t: tCommons } = useTranslation('commons');
|
|
@@ -43,7 +52,7 @@ const InstallerPage: NextPage<Props> = (props: Props) => {
|
|
|
return {
|
|
return {
|
|
|
user_infomation: {
|
|
user_infomation: {
|
|
|
Icon: () => <span className="material-symbols-outlined me-2">person</span>,
|
|
Icon: () => <span className="material-symbols-outlined me-2">person</span>,
|
|
|
- Content: InstallerForm,
|
|
|
|
|
|
|
+ Content: () => <InstallerForm minPasswordLength={props.minPasswordLength} />,
|
|
|
i18n: t('installer.tab'),
|
|
i18n: t('installer.tab'),
|
|
|
},
|
|
},
|
|
|
external_accounts: {
|
|
external_accounts: {
|
|
@@ -53,7 +62,7 @@ const InstallerPage: NextPage<Props> = (props: Props) => {
|
|
|
i18n: tCommons('g2g_data_transfer.tab'),
|
|
i18n: tCommons('g2g_data_transfer.tab'),
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
|
- }, [t, tCommons]);
|
|
|
|
|
|
|
+ }, [props.minPasswordLength, t, tCommons]);
|
|
|
|
|
|
|
|
// commons
|
|
// commons
|
|
|
useAppTitle(props.appTitle);
|
|
useAppTitle(props.appTitle);
|
|
@@ -76,6 +85,14 @@ const InstallerPage: NextPage<Props> = (props: Props) => {
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+async function injectServerConfigurations(context: GetServerSidePropsContext, props: Props): Promise<void> {
|
|
|
|
|
+ const req: CrowiRequest = context.req as CrowiRequest;
|
|
|
|
|
+ const { crowi } = req;
|
|
|
|
|
+ const { configManager } = crowi;
|
|
|
|
|
+
|
|
|
|
|
+ props.minPasswordLength = configManager.getConfig('crowi', 'app:minPasswordLength');
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
|
const result = await getServerSideCommonProps(context);
|
|
const result = await getServerSideCommonProps(context);
|
|
|
|
|
|
|
@@ -88,6 +105,7 @@ export const getServerSideProps: GetServerSideProps = async(context: GetServerSi
|
|
|
const props: Props = result.props as Props;
|
|
const props: Props = result.props as Props;
|
|
|
|
|
|
|
|
await injectNextI18NextConfigurations(context, props, ['translation']);
|
|
await injectNextI18NextConfigurations(context, props, ['translation']);
|
|
|
|
|
+ injectServerConfigurations(context, props);
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
props,
|
|
props,
|