Skip to content

Commit 8baae1c

Browse files
committed
Minor fixes and improvements
1 parent 8ed56d0 commit 8baae1c

2 files changed

Lines changed: 42 additions & 57 deletions

File tree

frontend/src/domain/authentication/LoginPage.tsx

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { createRef } from "react"
22
import { ArrowLeftOutlined, LockOutlined, SafetyOutlined, UserOutlined } from "@ant-design/icons"
33
import { Navigate } from "react-router-dom"
4-
import { Button, Input, Typography } from "antd"
4+
import { Button, Form, Input, Typography } from "antd"
55
import type { OTPRef } from "antd/es/input/OTP"
66
import AppContext from "../../core/components/context/AppContext"
77
import Preloader from "../../core/components/preloader/Preloader"
@@ -10,7 +10,7 @@ import "./LoginPage.css"
1010
import UserService from "../user/UserService"
1111
import LoginOutcome from "../user/model/LoginOutcome"
1212
import { navigateTo, queryParams } from "../../core/components/router/AppRouter"
13-
import { LoginFormPage, ProFormText } from "@ant-design/pro-components"
13+
import { LoginFormPage } from "@ant-design/pro-components"
1414
import ThemeContext from "../../core/components/context/ThemeContext"
1515
import LightBackground from "./background/light.jpg"
1616
import DarkBackground from "./background/dark.jpg"
@@ -205,28 +205,24 @@ export default class LoginPage extends React.Component<any, LoginPageState> {
205205
private renderCredentialFields() {
206206
return (
207207
<>
208-
<ProFormText
208+
<Form.Item
209209
name="username"
210-
placeholder={i18n(MessageKey.CommonUsername)}
211-
fieldProps={{
212-
size: "large",
213-
prefix: <UserOutlined />,
214-
}}
215-
style={{
216-
marginLeft: 20,
217-
}}
218-
/>
219-
<ProFormText.Password
210+
validateStatus={this.state.attemptFailed ? "error" : undefined}
211+
style={{ marginLeft: 20 }}
212+
>
213+
<Input placeholder={i18n(MessageKey.CommonUsername)} size="large" prefix={<UserOutlined />} />
214+
</Form.Item>
215+
<Form.Item
220216
name="password"
221-
placeholder={i18n(MessageKey.CommonPassword)}
222-
fieldProps={{
223-
size: "large",
224-
prefix: <LockOutlined />,
225-
}}
226-
style={{
227-
marginLeft: 20,
228-
}}
229-
/>
217+
validateStatus={this.state.attemptFailed ? "error" : undefined}
218+
style={{ marginLeft: 20 }}
219+
>
220+
<Input.Password
221+
placeholder={i18n(MessageKey.CommonPassword)}
222+
size="large"
223+
prefix={<LockOutlined />}
224+
/>
225+
</Form.Item>
230226
</>
231227
)
232228
}

frontend/src/domain/onboarding/OnboardingPage.tsx

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react"
2-
import { Button, Steps } from "antd"
2+
import { Button, Form, Input, Steps } from "antd"
33
import { IdcardOutlined, LockOutlined, SafetyOutlined, UserOutlined } from "@ant-design/icons"
44
import { Navigate } from "react-router-dom"
5-
import { LoginFormPage, ProFormText } from "@ant-design/pro-components"
5+
import { LoginFormPage } from "@ant-design/pro-components"
66
import AppContext from "../../core/components/context/AppContext"
77
import Preloader from "../../core/components/preloader/Preloader"
88
import Notification from "../../core/components/notification/Notification"
@@ -125,48 +125,37 @@ export default class OnboardingPage extends React.Component<any, OnboardingPageS
125125

126126
return (
127127
<>
128-
<ProFormText
128+
<Form.Item
129129
name="name"
130-
placeholder={i18n(MessageKey.CommonName)}
131130
initialValue={values.name}
132-
fieldProps={{
133-
size: "large",
134-
prefix: <IdcardOutlined />,
135-
}}
136-
formItemProps={{
137-
validateStatus: validationResult.getStatus("name"),
138-
help: validationResult.getMessage("name"),
139-
}}
131+
validateStatus={validationResult.getStatus("name")}
132+
help={validationResult.getMessage("name")}
140133
style={{ marginLeft: 20 }}
141-
/>
142-
<ProFormText
134+
>
135+
<Input placeholder={i18n(MessageKey.CommonName)} size="large" prefix={<IdcardOutlined />} />
136+
</Form.Item>
137+
<Form.Item
143138
name="username"
144-
placeholder={i18n(MessageKey.CommonUsername)}
145139
initialValue={values.username}
146-
fieldProps={{
147-
size: "large",
148-
prefix: <UserOutlined />,
149-
}}
150-
formItemProps={{
151-
validateStatus: validationResult.getStatus("username"),
152-
help: validationResult.getMessage("username"),
153-
}}
140+
validateStatus={validationResult.getStatus("username")}
141+
help={validationResult.getMessage("username")}
154142
style={{ marginLeft: 20 }}
155-
/>
156-
<ProFormText.Password
143+
>
144+
<Input placeholder={i18n(MessageKey.CommonUsername)} size="large" prefix={<UserOutlined />} />
145+
</Form.Item>
146+
<Form.Item
157147
name="password"
158-
placeholder={i18n(MessageKey.CommonPassword)}
159148
initialValue={values.password}
160-
fieldProps={{
161-
size: "large",
162-
prefix: <LockOutlined />,
163-
}}
164-
formItemProps={{
165-
validateStatus: validationResult.getStatus("password"),
166-
help: validationResult.getMessage("password"),
167-
}}
149+
validateStatus={validationResult.getStatus("password")}
150+
help={validationResult.getMessage("password")}
168151
style={{ marginLeft: 20 }}
169-
/>
152+
>
153+
<Input.Password
154+
placeholder={i18n(MessageKey.CommonPassword)}
155+
size="large"
156+
prefix={<LockOutlined />}
157+
/>
158+
</Form.Item>
170159
</>
171160
)
172161
}

0 commit comments

Comments
 (0)