Skip to content

Commit 2d6283d

Browse files
authored
feat(neuron-ui): remove input truncation on importing keystore. (#1068)
* feat(neuron-ui): remove input truncation on importing keystore. * refactor(neuron-ui): hide the password in error message
1 parent 8686707 commit 2d6283d

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

packages/neuron-ui/src/components/ImportKeystore/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteCo
9898
placeholder={t(`import-keystore.placeholder.${key}`)}
9999
type={key === 'password' ? 'password' : 'text'}
100100
readOnly={key === 'path'}
101-
maxLength={maxLength}
102101
value={value}
103102
validateOnLoad={false}
104103
onGetErrorMessage={(text?: string) => {
@@ -108,6 +107,13 @@ const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteCo
108107
if (key === 'name' && isNameUsed) {
109108
return t(`messages.codes.${ErrorCode.FieldUsed}`, { fieldName: `name`, fieldValue: text })
110109
}
110+
if (text && maxLength && text.length > maxLength) {
111+
return t(`messages.codes.${ErrorCode.FieldTooLong}`, {
112+
fieldName: key,
113+
fieldValue: key === 'password' ? '' : text,
114+
length: maxLength,
115+
})
116+
}
111117
return ''
112118
}}
113119
onChange={(_e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {

packages/neuron-ui/src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
"fields": {
260260
"wallet": "Wallet",
261261
"name": "Name",
262+
"password": "Password",
262263
"remote": "RPC URL",
263264
"network": "Network",
264265
"address": "Address",

packages/neuron-ui/src/locales/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
"fields": {
260260
"wallet": "钱包",
261261
"name": "名称",
262+
"password": "密码",
262263
"remote": "RPC URL",
263264
"network": "网络",
264265
"address": "地址",

0 commit comments

Comments
 (0)