|
|
@@ -1,18 +1,24 @@
|
|
|
import React from 'react';
|
|
|
|
|
|
import { NextPage, GetServerSideProps, GetServerSidePropsContext } from 'next';
|
|
|
-import { useTranslation } from 'next-i18next';
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
|
|
import dynamic from 'next/dynamic';
|
|
|
|
|
|
+import { CrowiRequest } from '~/interfaces/crowi-request';
|
|
|
+import { useIsMailerSetup } from '~/stores/context';
|
|
|
+
|
|
|
import {
|
|
|
CommonProps, getNextI18NextConfig, getServerSideCommonProps,
|
|
|
} from './utils/commons';
|
|
|
|
|
|
const PasswordResetRequestForm = dynamic(() => import('~/components/PasswordResetRequestForm'), { ssr: false });
|
|
|
|
|
|
-const ForgotPasswordPage: NextPage = () => {
|
|
|
- const { t } = useTranslation();
|
|
|
+type Props = CommonProps & {
|
|
|
+ isMailerSetup: boolean,
|
|
|
+};
|
|
|
+
|
|
|
+const ForgotPasswordPage: NextPage<Props> = (props: Props) => {
|
|
|
+ useIsMailerSetup(props.isMailerSetup);
|
|
|
|
|
|
return (
|
|
|
<div id="main" className="main">
|
|
|
@@ -21,8 +27,6 @@ const ForgotPasswordPage: NextPage = () => {
|
|
|
<div className="row justify-content-md-center">
|
|
|
<div className="col-md-6 mt-5">
|
|
|
<div className="text-center">
|
|
|
- <h1><i className="icon-lock large"></i></h1>
|
|
|
- <h1 className="text-center">{ t('forgot_password.forgot_password') }</h1>
|
|
|
<PasswordResetRequestForm />
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -34,11 +38,19 @@ const ForgotPasswordPage: NextPage = () => {
|
|
|
};
|
|
|
|
|
|
// eslint-disable-next-line max-len
|
|
|
-async function injectNextI18NextConfigurations(context: GetServerSidePropsContext, props: CommonProps, namespacesRequired?: string[] | undefined): Promise<void> {
|
|
|
+async function injectNextI18NextConfigurations(context: GetServerSidePropsContext, props: Props, namespacesRequired?: string[] | undefined): Promise<void> {
|
|
|
const nextI18NextConfig = await getNextI18NextConfig(serverSideTranslations, context, namespacesRequired);
|
|
|
props._nextI18Next = nextI18NextConfig._nextI18Next;
|
|
|
}
|
|
|
|
|
|
+const injectServerConfigurations = async(context: GetServerSidePropsContext, props: Props): Promise<void> => {
|
|
|
+ const req: CrowiRequest = context.req as CrowiRequest;
|
|
|
+ const { crowi } = req;
|
|
|
+ const { mailService } = crowi;
|
|
|
+
|
|
|
+ props.isMailerSetup = mailService.isMailerSetup;
|
|
|
+};
|
|
|
+
|
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
|
const result = await getServerSideCommonProps(context);
|
|
|
|
|
|
@@ -48,8 +60,9 @@ export const getServerSideProps: GetServerSideProps = async(context: GetServerSi
|
|
|
throw new Error('invalid getSSP result');
|
|
|
}
|
|
|
|
|
|
- const props: CommonProps = result.props as CommonProps;
|
|
|
+ const props: Props = result.props as Props;
|
|
|
|
|
|
+ injectServerConfigurations(context, props);
|
|
|
await injectNextI18NextConfigurations(context, props, ['translation', 'commons']);
|
|
|
|
|
|
return {
|