Skip to content

Commit 5fd7403

Browse files
hide password field and signup option when Email based auth is disabled
1 parent 0f71d0f commit 5fd7403

File tree

3 files changed

+46
-30
lines changed

3 files changed

+46
-30
lines changed

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,6 +3011,7 @@ export const en = {
30113011
"poweredByLowcoder": "Powered by: Lowcoder.cloud",
30123012
"continue": "Continue",
30133013
"enterPassword": "Enter your password",
3014+
"selectAuthProvider": "Select Authentication Provider",
30143015
"selectWorkspace": "Select your workspace",
30153016
},
30163017
"preLoad": {
@@ -3546,6 +3547,7 @@ export const en = {
35463547
"saveSuccess": "Saved Successfully",
35473548
"dangerLabel": "Danger Zone",
35483549
"dangerTip": "Disabling or Deleting This ID Provider May Result in Some Users Being Unable to Log In. Proceed With Caution.",
3550+
"lastEnabledConfig": "You can't disable/delete config as this is the only enabled configuration.",
35493551
"disable": "Disable",
35503552
"disableSuccess": "Disabled Successfully",
35513553
"encryptedServer": "-------- Encrypted on the Server Side --------",

client/packages/lowcoder/src/pages/userAuth/formLoginSteps.tsx

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export default function FormLoginSteps(props: FormLoginProps) {
101101
const { systemConfig, inviteInfo, fetchUserAfterAuthSuccess } = useContext(AuthContext);
102102
const invitationId = inviteInfo?.invitationId;
103103
const authId = systemConfig?.form.id;
104+
const isFormLoginEnabled = systemConfig?.form.enableLogin;
104105
const [orgLoading, setOrgLoading] = useState(false);
105106
const [orgList, setOrgList] = useState<OrgItem[]>([]);
106107
const [currentStep, setCurrentStep] = useState<CurrentStepEnum>(CurrentStepEnum.EMAIL);
@@ -227,27 +228,35 @@ export default function FormLoginSteps(props: FormLoginProps) {
227228
if (skipWorkspaceStep) return setCurrentStep(CurrentStepEnum.EMAIL);
228229
setCurrentStep(CurrentStepEnum.WORKSPACES)
229230
}} />
230-
<StepHeader title={trans("userAuth.enterPassword")} />
231-
<PasswordInput
232-
className="form-input password-input"
233-
passInputConf={{
234-
label: ' ',
235-
}}
236-
onChange={(value) => setPassword(value)}
237-
valueCheck={() => [true, ""]}
231+
<StepHeader
232+
title={
233+
isFormLoginEnabled ? trans("userAuth.enterPassword") : trans("userAuth.selectAuthProvider")
234+
}
238235
/>
239-
<Flex justify="end" style={{margin: '10px 0'}}>
240-
<Link to={{
241-
pathname: AUTH_FORGOT_PASSWORD_URL,
242-
state: location.state
243-
}}
244-
>
245-
{`${trans("userAuth.forgotPassword")}?`}
246-
</Link>
247-
</Flex>
248-
<ConfirmButton loading={loading} disabled={!account || !password} onClick={onSubmit}>
249-
{trans("userAuth.login")}
250-
</ConfirmButton>
236+
{isFormLoginEnabled && (
237+
<>
238+
<PasswordInput
239+
className="form-input password-input"
240+
passInputConf={{
241+
label: ' ',
242+
}}
243+
onChange={(value) => setPassword(value)}
244+
valueCheck={() => [true, ""]}
245+
/>
246+
<Flex justify="end" style={{margin: '10px 0'}}>
247+
<Link to={{
248+
pathname: AUTH_FORGOT_PASSWORD_URL,
249+
state: location.state
250+
}}
251+
>
252+
{`${trans("userAuth.forgotPassword")}?`}
253+
</Link>
254+
</Flex>
255+
<ConfirmButton loading={loading} disabled={!account || !password} onClick={onSubmit}>
256+
{trans("userAuth.login")}
257+
</ConfirmButton>
258+
</>
259+
)}
251260
{organizationId && (
252261
<ThirdPartyAuth
253262
invitationId={invitationId}
@@ -256,15 +265,19 @@ export default function FormLoginSteps(props: FormLoginProps) {
256265
/>
257266
)}
258267
</AccountLoginWrapper>
259-
<Divider/>
260-
<AuthBottomView>
261-
<StyledRouteLink to={{
262-
pathname: AUTH_REGISTER_URL,
263-
state: location.state
264-
}}>
265-
{trans("userAuth.register")}
266-
</StyledRouteLink>
267-
</AuthBottomView>
268+
{isFormLoginEnabled && (
269+
<>
270+
<Divider/>
271+
<AuthBottomView>
272+
<StyledRouteLink to={{
273+
pathname: AUTH_REGISTER_URL,
274+
state: location.state
275+
}}>
276+
{trans("userAuth.register")}
277+
</StyledRouteLink>
278+
</AuthBottomView>
279+
</>
280+
)}
268281
</>
269282
);
270283
}

client/packages/lowcoder/src/pages/userAuth/thirdParty/thirdPartyAuth.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export function ThirdPartyAuth(props: {
111111
}) {
112112
const systemConfigFetching = useSelector(getSystemConfigFetching);
113113
const systemConfig = useSelector(selectSystemConfig);
114+
const isFormLoginEnabled = systemConfig?.form.enableLogin;
114115

115116
if (systemConfigFetching) {
116117
return <Spin indicator={<LoadingOutlined style={{ fontSize: 15, marginTop: '16px' }} spin />} />;
@@ -139,7 +140,7 @@ export function ThirdPartyAuth(props: {
139140
});
140141
return (
141142
<ThirdPartyLoginButtonWrapper>
142-
{ Boolean(socialLoginButtons.length) && (
143+
{ isFormLoginEnabled && Boolean(socialLoginButtons.length) && (
143144
<Divider plain>
144145
<Text type="secondary">or</Text>
145146
</Divider>

0 commit comments

Comments
 (0)