From f7735ccce31381b280b7455e3f127e9b3b012023 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 6 Apr 2022 10:58:21 +0800 Subject: [PATCH] fix(client): allow sign up --- packages/client/src/user/SigninPage.tsx | 8 ++++++-- packages/client/src/user/SignupPage.tsx | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) 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 ; };