jam411 3 years ago
parent
commit
c109dc10d2

+ 2 - 2
packages/app/src/components/Login/InvitedForm.tsx

@@ -5,8 +5,8 @@ import { useTranslation } from 'next-i18next';
 import { useCsrfToken, useCurrentUser } from '../../stores/context';
 
 type InvitedFormProps = {
-  invitedFormUsername?: string,
-  invitedFormName?: string,
+  invitedFormUsername: string,
+  invitedFormName: string,
 }
 
 export const InvitedForm = (props: InvitedFormProps): JSX.Element => {

+ 8 - 4
packages/app/src/pages/login/[[...path]].page.tsx

@@ -22,8 +22,8 @@ type Props = CommonProps & {
   enabledStrategies: unknown,
   registrationWhiteList: string[],
   currentUser: IUser,
-  invitedFormUsername?: string,
-  invitedFormName?: string,
+  invitedFormUsername: string,
+  invitedFormName: string,
 }
 
 const LoginPage: NextPage<Props> = (props: Props) => {
@@ -81,8 +81,12 @@ async function injectServerConfigurations(context: GetServerSidePropsContext, pr
   props.isMailerSetup = mailService.isMailerSetup;
   props.registrationWhiteList = configManager.getConfig('crowi', 'security:registrationWhiteList');
 
-  props.invitedFormUsername = invitedForm.username;
-  props.invitedFormName = invitedForm.name;
+  if (props.invitedFormUsername != null) {
+    props.invitedFormUsername = invitedForm.username;
+  }
+  if (props.invitedFormName != null) {
+    props.invitedFormName = invitedForm.name;
+  }
 }
 
 function injectEnabledStrategies(context: GetServerSidePropsContext, props: Props): void {