Skip to content

Commit

Permalink
feat(neuron-ui): remove input truncation on importing keystore. (#1068)
Browse files Browse the repository at this point in the history
* feat(neuron-ui): remove input truncation on importing keystore.

* refactor(neuron-ui): hide the password in error message
  • Loading branch information
Keith-CY authored Nov 11, 2019
1 parent 8686707 commit 2d6283d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/neuron-ui/src/components/ImportKeystore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteCo
placeholder={t(`import-keystore.placeholder.${key}`)}
type={key === 'password' ? 'password' : 'text'}
readOnly={key === 'path'}
maxLength={maxLength}
value={value}
validateOnLoad={false}
onGetErrorMessage={(text?: string) => {
Expand All @@ -108,6 +107,13 @@ const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteCo
if (key === 'name' && isNameUsed) {
return t(`messages.codes.${ErrorCode.FieldUsed}`, { fieldName: `name`, fieldValue: text })
}
if (text && maxLength && text.length > maxLength) {
return t(`messages.codes.${ErrorCode.FieldTooLong}`, {
fieldName: key,
fieldValue: key === 'password' ? '' : text,
length: maxLength,
})
}
return ''
}}
onChange={(_e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
"fields": {
"wallet": "Wallet",
"name": "Name",
"password": "Password",
"remote": "RPC URL",
"network": "Network",
"address": "Address",
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
"fields": {
"wallet": "钱包",
"name": "名称",
"password": "密码",
"remote": "RPC URL",
"network": "网络",
"address": "地址",
Expand Down

0 comments on commit 2d6283d

Please sign in to comment.