Skip to content

Commit 451cb73

Browse files
feat: show custom message if set
1 parent 8b01d78 commit 451cb73

File tree

8 files changed

+60
-36
lines changed

8 files changed

+60
-36
lines changed

client/packages/lowcoder-dev-utils/buildVars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const buildVars = [
3737
},
3838
{
3939
name: "LOWCODER_CUSTOM_AUTH_WELCOME_TEXT",
40-
defaultValue: "This is custom welcome message",
40+
defaultValue: "",
4141
},
4242
{
4343
name: "REACT_APP_ENV",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,7 @@ export const en = {
19601960
resetSuccess: "Reset succeeded",
19611961
resetSuccessDesc: "Password reset succeeded. The new password is: {password}",
19621962
copyPassword: "Copy password",
1963+
poweredByLowcoder: "Powered by Lowcoder.cloud"
19631964
},
19641965
preLoad: {
19651966
jsLibraryHelpText:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,7 @@ userAuth: {
19341934
resetSuccess: "重置成功",
19351935
resetSuccessDesc: "密码重置成功.新密码为:{password}",
19361936
copyPassword: "复制密码",
1937+
poweredByLowcoder: "供电 Lowcoder.cloud"
19371938
},
19381939
preLoad: {
19391940
jsLibraryHelpText: "通过URL链接向当前应用程序添加JavaScript库.lodash、day.js、uuid、numbro内置于系统中,可立即使用.JavaScript库在应用程序初始化之前加载,这可能会影响应用程序的性能.",

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const AuthCard = styled.div`
3232
}
3333
`;
3434

35-
const AuthCardTitle = styled.div<{ type?: string }>`
35+
const AuthCardHeading = styled.div<{ type?: string }>`
3636
font-weight: 600;
3737
font-size: 28px;
3838
color: #222222;
@@ -51,6 +51,12 @@ const AuthCardTitle = styled.div<{ type?: string }>`
5151
}
5252
`;
5353

54+
const AuthCardSubHeading = styled.div`
55+
font-size: 14px;
56+
color: #222222;
57+
line-height: 14px;
58+
`
59+
5460
const AuthBottom = styled.div`
5561
display: flex;
5662
align-items: center;
@@ -116,10 +122,24 @@ const StyledConfirmButton = styled(TacoButton)`
116122
transition: unset;
117123
`;
118124

119-
export const AuthContainer = (props: { children: any; title?: string; type?: string }) => {
125+
export const AuthContainer = (props: {
126+
children: any;
127+
heading?: string;
128+
subHeading?: string;
129+
type?: string
130+
}) => {
120131
return (
121132
<AuthCardContainer>
122-
<AuthCardTitle type={props.type}>{props.title || ""}</AuthCardTitle>
133+
<AuthCardHeading
134+
type={props.type}
135+
>
136+
{props.heading || ""}
137+
</AuthCardHeading>
138+
{ props.subHeading && (
139+
<AuthCardSubHeading>
140+
{props.subHeading}
141+
</AuthCardSubHeading>
142+
)}
123143
<AuthCard>{props.children}</AuthCard>
124144
</AuthCardContainer>
125145
);

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

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
LoginCardTitle,
77
StyledRouteLink,
88
} from "pages/userAuth/authComponents";
9-
import React, { useContext, useMemo, useState } from "react";
9+
import React, { useContext, useState } from "react";
1010
import styled from "styled-components";
1111
import UserApi from "api/userApi";
1212
import { useRedirectUrl } from "util/hooks";
@@ -17,7 +17,6 @@ import { AuthContext, useAuthSubmit } from "pages/userAuth/authUtils";
1717
import { ThirdPartyAuth } from "pages/userAuth/thirdParty/thirdPartyAuth";
1818
import { AUTH_REGISTER_URL, ORG_AUTH_REGISTER_URL } from "constants/routesURL";
1919
import { useLocation, useParams } from "react-router-dom";
20-
import { Divider } from "antd";
2120

2221
const AccountLoginWrapper = styled(FormWrapperMobile)`
2322
display: flex;
@@ -39,13 +38,6 @@ export default function FormLogin(props: FormLoginProps) {
3938
const location = useLocation();
4039
const orgId = useParams<any>().orgId;
4140

42-
// const organizationId = useMemo(() => {
43-
// if(inviteInfo?.invitedOrganizationId) {
44-
// return inviteInfo?.invitedOrganizationId;
45-
// }
46-
// return orgId;
47-
// }, [ inviteInfo, orgId ])
48-
4941
const { onSubmit, loading } = useAuthSubmit(
5042
() =>
5143
UserApi.formLogin({
@@ -84,14 +76,11 @@ export default function FormLogin(props: FormLoginProps) {
8476
</ConfirmButton>
8577

8678
{props.organizationId && (
87-
<>
88-
<Divider />
89-
<ThirdPartyAuth
90-
invitationId={invitationId}
91-
invitedOrganizationId={props.organizationId}
92-
authGoal="login"
93-
/>
94-
</>
79+
<ThirdPartyAuth
80+
invitationId={invitationId}
81+
invitedOrganizationId={props.organizationId}
82+
authGoal="login"
83+
/>
9584
)}
9685
</AccountLoginWrapper>
9786
<AuthBottomView>

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const thirdPartyLoginLabel = (name: string) => trans("userAuth.signInLabel", { n
6464
export const ThirdPartyBindCard = () => {
6565
const { systemConfig } = useContext(AuthContext);
6666
return (
67-
<AuthContainer title={trans("userAuth.bindAccount")}>
67+
<AuthContainer heading={trans("userAuth.bindAccount")}>
6868
<ThirdAuthWrapper>
6969
<ThirdPartyAuth
7070
authGoal="bind"
@@ -131,12 +131,19 @@ function Login() {
131131
loginCardView = thirdPartyLoginView;
132132
}
133133

134-
const loginTitle = organizationId && LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
134+
const loginHeading = organizationId && LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
135135
? LOWCODER_CUSTOM_AUTH_WELCOME_TEXT
136136
: getLoginTitle(inviteInfo?.createUserName, systemConfig?.branding?.brandName)
137137

138+
const loginSubHeading = organizationId && LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
139+
? trans("userAuth.poweredByLowcoder")
140+
: ''
141+
138142
return (
139-
<AuthContainer title={loginTitle} >
143+
<AuthContainer
144+
heading={loginHeading}
145+
subHeading={loginSubHeading}
146+
>
140147
{loginCardView}
141148
</AuthContainer>
142149
);

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { useLocation } from "react-router-dom";
1818
import { UserConnectionSource } from "@lowcoder-ee/constants/userConstants";
1919
import { trans } from "i18n";
2020
import { AuthContext, checkPassWithMsg, useAuthSubmit } from "pages/userAuth/authUtils";
21-
import { Divider } from "antd";
2221
import { ThirdPartyAuth } from "pages/userAuth/thirdParty/thirdPartyAuth";
2322
import { useParams } from "react-router-dom";
2423

@@ -72,12 +71,20 @@ function UserRegister() {
7271
return null;
7372
}
7473

75-
const registerTitle = organizationId && LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
74+
const registerHeading = organizationId && LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
7675
? LOWCODER_CUSTOM_AUTH_WELCOME_TEXT
7776
: trans("userAuth.register")
7877

78+
const registerSubHeading = organizationId && LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
79+
? trans("userAuth.poweredByLowcoder")
80+
: ''
81+
7982
return (
80-
<AuthContainer title={registerTitle} type="large">
83+
<AuthContainer
84+
heading={registerHeading}
85+
subHeading={registerSubHeading}
86+
type="large"
87+
>
8188
<RegisterContent>
8289
<LoginCardTitle>{trans("userAuth.registerByEmail")}</LoginCardTitle>
8390
<StyledFormInput
@@ -104,15 +111,12 @@ function UserRegister() {
104111
{trans("userAuth.register")}
105112
</ConfirmButton>
106113
<TermsAndPrivacyInfo onCheckChange={(e) => setSubmitBtnDisable(!e.target.checked)} />
107-
{Boolean(invitationId) && (
108-
<>
109-
<Divider />
110-
<ThirdPartyAuth
111-
invitationId={invitationId}
112-
invitedOrganizationId={organizationId}
113-
authGoal="register"
114-
/>
115-
</>
114+
{organizationId && (
115+
<ThirdPartyAuth
116+
invitationId={invitationId}
117+
invitedOrganizationId={organizationId}
118+
authGoal="register"
119+
/>
116120
)}
117121
</RegisterContent>
118122
<StyledRouteLinkLogin to={{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { messageInstance } from "lowcoder-design";
1515
import styled from "styled-components";
1616
import { trans } from "i18n";
1717
import { geneAuthStateAndSaveParam, getAuthUrl, getRedirectUrl } from "pages/userAuth/authUtils";
18+
import { Divider } from "antd";
1819

1920
const ThirdPartyLoginButtonWrapper = styled.div`
2021
button{
@@ -128,6 +129,7 @@ export function ThirdPartyAuth(props: {
128129
});
129130
return (
130131
<ThirdPartyLoginButtonWrapper>
132+
{ Boolean(socialLoginButtons.length) && <Divider /> }
131133
{socialLoginButtons}
132134
</ThirdPartyLoginButtonWrapper>
133135
);

0 commit comments

Comments
 (0)