Skip to content

Commit b608ae6

Browse files
author
shuai
committed
fix: password maxlength remove
1 parent f7602dd commit b608ae6

9 files changed

Lines changed: 70 additions & 35 deletions

File tree

i18n/en_US.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,12 +1263,14 @@ ui:
12631263
site_name:
12641264
label: Site name
12651265
msg: Site name cannot be empty.
1266+
msg_max_length: Site name must be at maximum 30 characters in length.
12661267
site_url:
12671268
label: Site URL
12681269
text: The address of your site.
12691270
msg:
12701271
empty: Site URL cannot be empty.
12711272
incorrect: Site URL incorrect format.
1273+
max_length: Site URL must be at maximum 512 characters in length.
12721274
contact_email:
12731275
label: Contact email
12741276
text: Email address of key contact responsible for this site.
@@ -1283,12 +1285,15 @@ ui:
12831285
label: Name
12841286
msg: Name cannot be empty.
12851287
character: 'Must use the character set "a-z", "0-9", " - . _"'
1288+
msg_max_length: Name must be at maximum 30 characters in length.
12861289
admin_password:
12871290
label: Password
12881291
text: >-
12891292
You will need this password to log in. Please store it in a secure
12901293
location.
12911294
msg: Password cannot be empty.
1295+
msg_min_length: Password must be at least 8 characters in length.
1296+
msg_max_length: Password must be at maximum 32 characters in length.
12921297
admin_email:
12931298
label: Email
12941299
text: You will need this email to log in.

ui/src/components/Editor/toolItem.tsx

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FC, useContext, useEffect } from 'react';
2-
import { Dropdown, OverlayTrigger, Tooltip, Button } from 'react-bootstrap';
2+
import { Dropdown, Button } from 'react-bootstrap';
33

44
import { EditorContext } from './EditorContext';
55

@@ -49,28 +49,27 @@ const ToolItem: FC<IProps> = (props) => {
4949
}, []);
5050

5151
const btnRender = () => (
52-
<OverlayTrigger placement="bottom" overlay={<Tooltip>{tip}</Tooltip>}>
53-
<Button
54-
variant="link"
55-
className={`p-0 b-0 btn-no-border toolbar icon-${label} ${
56-
disable ? 'disabled' : ''
57-
} `}
58-
disabled={disable}
59-
tabIndex={-1}
60-
onClick={(e) => {
61-
e.preventDefault();
62-
if (typeof onClick === 'function') {
63-
onClick();
64-
}
65-
}}
66-
onBlur={(e) => {
67-
e.preventDefault();
68-
if (typeof onBlur === 'function') {
69-
onBlur();
70-
}
71-
}}
72-
/>
73-
</OverlayTrigger>
52+
<Button
53+
variant="link"
54+
title={tip}
55+
className={`p-0 b-0 btn-no-border toolbar icon-${label} ${
56+
disable ? 'disabled' : ''
57+
} `}
58+
disabled={disable}
59+
tabIndex={-1}
60+
onClick={(e) => {
61+
e.preventDefault();
62+
if (typeof onClick === 'function') {
63+
onClick();
64+
}
65+
}}
66+
onBlur={(e) => {
67+
e.preventDefault();
68+
if (typeof onBlur === 'function') {
69+
onBlur();
70+
}
71+
}}
72+
/>
7473
);
7574

7675
if (!context) {

ui/src/pages/Install/components/FourthStep/index.tsx

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
2828
};
2929
}
3030

31+
if (site_name.value && site_name.value.length > 30) {
32+
bol = false;
33+
data.site_url = {
34+
value: site_name.value,
35+
isInvalid: true,
36+
errorMsg: t('site_name.msg_max_length'),
37+
};
38+
}
39+
3140
if (!site_url.value) {
3241
bol = false;
3342
data.site_url = {
@@ -36,6 +45,7 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
3645
errorMsg: t('site_name.msg.empty'),
3746
};
3847
}
48+
3949
const reg = /^(http|https):\/\//g;
4050
if (site_url.value && !site_url.value.match(reg)) {
4151
bol = false;
@@ -44,6 +54,13 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
4454
isInvalid: true,
4555
errorMsg: t('site_url.msg.incorrect'),
4656
};
57+
} else if (site_url.value.length > 512) {
58+
bol = false;
59+
data.site_url = {
60+
value: site_url.value,
61+
isInvalid: true,
62+
errorMsg: t('site_url.msg.max_length'),
63+
};
4764
}
4865

4966
if (!contact_email.value) {
@@ -78,6 +95,13 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
7895
isInvalid: true,
7996
errorMsg: t('admin_name.character'),
8097
};
98+
} else if (data.name.value.length > 30) {
99+
bol = false;
100+
data.name = {
101+
value: data.name.value,
102+
isInvalid: true,
103+
errorMsg: t('admin_name.msg_max_length'),
104+
};
81105
}
82106

83107
if (!password.value) {
@@ -89,6 +113,24 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
89113
};
90114
}
91115

116+
if (password.value && password.value.length < 4) {
117+
bol = false;
118+
data.password = {
119+
value: data.password.value,
120+
isInvalid: true,
121+
errorMsg: t('admin_password.msg_min_length'),
122+
};
123+
}
124+
125+
if (password.value && password.value.length > 32) {
126+
bol = false;
127+
data.password = {
128+
value: data.password.value,
129+
isInvalid: true,
130+
errorMsg: t('admin_password.msg_max_length'),
131+
};
132+
}
133+
92134
if (!email.value) {
93135
bol = false;
94136
data.email = {
@@ -132,7 +174,6 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
132174
required
133175
value={data.site_name.value}
134176
isInvalid={data.site_name.isInvalid}
135-
maxLength={30}
136177
onChange={(e) => {
137178
changeCallback({
138179
site_name: {
@@ -153,7 +194,6 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
153194
required
154195
value={data.site_url.value}
155196
isInvalid={data.site_url.isInvalid}
156-
maxLength={512}
157197
onChange={(e) => {
158198
changeCallback({
159199
site_url: {
@@ -220,7 +260,6 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
220260
required
221261
value={data.name.value}
222262
isInvalid={data.name.isInvalid}
223-
maxLength={30}
224263
onChange={(e) => {
225264
changeCallback({
226265
name: {
@@ -241,7 +280,6 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
241280
<Form.Control
242281
required
243282
type="password"
244-
maxLength={32}
245283
value={data.password.value}
246284
isInvalid={data.password.isInvalid}
247285
onChange={(e) => {

ui/src/pages/Install/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323

2424
const Index: FC = () => {
2525
const { t } = useTranslation('translation', { keyPrefix: 'install' });
26-
const [step, setStep] = useState(1);
26+
const [step, setStep] = useState(4);
2727
const [loading, setLoading] = useState(true);
2828
const [errorData, setErrorData] = useState<{ [propName: string]: any }>({
2929
msg: '',

ui/src/pages/Users/Login/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ const Index: React.FC = () => {
187187
tabIndex={1}
188188
type="password"
189189
// value={formData.pass.value}
190-
maxLength={32}
191190
isInvalid={formData.pass.isInvalid}
192191
onChange={(e) =>
193192
handleChange({

ui/src/pages/Users/PasswordReset/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ const Index: React.FC = () => {
127127
autoComplete="off"
128128
required
129129
type="password"
130-
maxLength={32}
131130
isInvalid={formData.pass.isInvalid}
132131
onChange={(e) => {
133132
handleChange({
@@ -150,7 +149,6 @@ const Index: React.FC = () => {
150149
autoComplete="off"
151150
required
152151
type="password"
153-
maxLength={32}
154152
isInvalid={formData.passSecond.isInvalid}
155153
onChange={(e) => {
156154
handleChange({

ui/src/pages/Users/Register/components/SignUpForm/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ const Index: React.FC<Props> = ({ callback }) => {
184184
autoComplete="off"
185185
required
186186
type="password"
187-
maxLength={32}
188187
isInvalid={formData.pass.isInvalid}
189188
value={formData.pass.value}
190189
onChange={(e) =>

ui/src/pages/Users/Settings/Account/components/ModifyEmail/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ const Index: FC = () => {
158158
autoComplete="new-password"
159159
required
160160
type="password"
161-
maxLength={32}
162161
isInvalid={formData.pass.isInvalid}
163162
onChange={(e) =>
164163
handleChange({

ui/src/pages/Users/Settings/Account/components/ModifyPass/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ const Index: FC = () => {
185185
autoComplete="off"
186186
required
187187
type="password"
188-
maxLength={32}
189188
isInvalid={formData.pass.isInvalid}
190189
onChange={(e) =>
191190
handleChange({
@@ -208,7 +207,6 @@ const Index: FC = () => {
208207
autoComplete="off"
209208
required
210209
type="password"
211-
maxLength={32}
212210
isInvalid={formData.pass2.isInvalid}
213211
onChange={(e) =>
214212
handleChange({

0 commit comments

Comments
 (0)