diff --git a/packages/client/src/user/SigninPage.tsx b/packages/client/src/user/SigninPage.tsx index 018a637db..5be8e6b8e 100644 --- a/packages/client/src/user/SigninPage.tsx +++ b/packages/client/src/user/SigninPage.tsx @@ -2,7 +2,7 @@ import { ISchema, useForm } from '@formily/react'; import { uid } from '@formily/shared'; import React from 'react'; import { useHistory } from 'react-router-dom'; -import { SchemaComponent, useAPIClient, useCurrentDocumentTitle } from '..'; +import { SchemaComponent, useAPIClient, useCurrentDocumentTitle, useSystemSettings } from '..'; const schema: ISchema = { type: 'object', @@ -45,6 +45,7 @@ const schema: ISchema = { link: { type: 'void', 'x-component': 'div', + 'x-visible': '{{allowSignUp}}', properties: { link: { title: '{{t("Create an account")}}', @@ -78,9 +79,12 @@ const useSignin = () => { export const SigninPage = () => { useCurrentDocumentTitle('Signin'); + const ctx = useSystemSettings(); + const allowSignUp = ctx?.data?.data?.allowSignUp; + console.log('ctx.data.allowSignUp', ctx?.data?.data?.allowSignUp); return (
- +
); }; diff --git a/packages/client/src/user/SignupPage.tsx b/packages/client/src/user/SignupPage.tsx index feae5c6b4..6b88ec8b3 100644 --- a/packages/client/src/user/SignupPage.tsx +++ b/packages/client/src/user/SignupPage.tsx @@ -2,8 +2,8 @@ import { ISchema, useForm } from '@formily/react'; import { uid } from '@formily/shared'; import { message } from 'antd'; import React from 'react'; -import { useHistory } from 'react-router-dom'; -import { SchemaComponent, useAPIClient, useCurrentDocumentTitle } from '..'; +import { Redirect, useHistory } from 'react-router-dom'; +import { SchemaComponent, useAPIClient, useCurrentDocumentTitle, useSystemSettings } from '..'; const schema: ISchema = { type: 'object', @@ -105,5 +105,10 @@ const useSignup = () => { export const SignupPage = () => { useCurrentDocumentTitle('Signup'); + const ctx = useSystemSettings(); + const allowSignUp = ctx?.data?.data?.allowSignUp; + if (!allowSignUp) { + return ; + } return ; };