Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wallet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
wallet
Commits
fe058899
Commit
fe058899
authored
1 year ago
by
Quoc Huy Nguyen Dinh
Browse files
Options
Downloads
Patches
Plain Diff
Multiple dashes in username is valid
parent
f578191d
No related branches found
No related tags found
2 merge requests
!145
Merge branch 'develop' into 'master'
,
!144
Multiple dashes in username is valid
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/utils/ChainValidation.js
+8
-18
8 additions, 18 deletions
src/app/utils/ChainValidation.js
with
8 additions
and
18 deletions
src/app/utils/ChainValidation.js
+
8
−
18
View file @
fe058899
import
tt
from
'
counterpart
'
;
import
tt
from
'
counterpart
'
;
import
BadActorList
from
'
app/utils/BadActorList
'
;
import
BadActorList
from
'
app/utils/BadActorList
'
;
import
VerifiedExchangeList
from
'
app/utils/VerifiedExchangeList
'
;
import
VerifiedExchangeList
from
'
app/utils/VerifiedExchangeList
'
;
import
{
PrivateKey
,
PublicKey
}
from
'
@hiveio/hive-js/lib/auth/ecc
'
;
import
{
PrivateKey
}
from
'
@hiveio/hive-js/lib/auth/ecc
'
;
export
function
validate_account_name
(
value
)
{
export
function
validate_account_name
(
value
)
{
let
i
,
label
,
len
,
length
,
ref
;
let
i
,
label
,
len
;
if
(
!
value
)
{
if
(
!
value
)
{
return
tt
(
'
chainvalidation_js.account_name_should_not_be_empty
'
);
return
tt
(
'
chainvalidation_js.account_name_should_not_be_empty
'
);
}
}
length
=
value
.
length
;
const
length
=
value
.
length
;
if
(
length
<
3
)
{
if
(
length
<
3
)
{
return
tt
(
'
chainvalidation_js.account_name_should_be_longer
'
);
return
tt
(
'
chainvalidation_js.account_name_should_be_longer
'
);
}
}
...
@@ -19,8 +19,8 @@ export function validate_account_name(value) {
...
@@ -19,8 +19,8 @@ export function validate_account_name(value) {
if
(
BadActorList
.
includes
(
value
))
{
if
(
BadActorList
.
includes
(
value
))
{
return
tt
(
'
chainvalidation_js.badactor
'
);
return
tt
(
'
chainvalidation_js.badactor
'
);
}
}
ref
=
value
.
split
(
'
.
'
);
const
ref
=
value
.
split
(
'
.
'
);
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
+=
1
)
{
label
=
ref
[
i
];
label
=
ref
[
i
];
if
(
!
/^
[
a-z
]
/
.
test
(
label
))
{
if
(
!
/^
[
a-z
]
/
.
test
(
label
))
{
return
tt
(
return
tt
(
...
@@ -32,17 +32,12 @@ export function validate_account_name(value) {
...
@@ -32,17 +32,12 @@ export function validate_account_name(value) {
'
chainvalidation_js.each_account_segment_should_have_only_letters_digits_or_dashes
'
'
chainvalidation_js.each_account_segment_should_have_only_letters_digits_or_dashes
'
);
);
}
}
if
(
/--/
.
test
(
label
))
{
return
tt
(
'
chainvalidation_js.each_account_segment_should_have_only_one_dash_in_a_row
'
);
}
if
(
!
/
[
a-z0-9
]
$/
.
test
(
label
))
{
if
(
!
/
[
a-z0-9
]
$/
.
test
(
label
))
{
return
tt
(
return
tt
(
'
chainvalidation_js.each_account_segment_should_end_with_a_letter_or_digit
'
'
chainvalidation_js.each_account_segment_should_end_with_a_letter_or_digit
'
);
);
}
}
if
(
!
(
label
.
length
>=
3
)
)
{
if
(
label
.
length
<
3
)
{
return
tt
(
return
tt
(
'
chainvalidation_js.each_account_segment_should_be_longer
'
'
chainvalidation_js.each_account_segment_should_be_longer
'
);
);
...
@@ -67,7 +62,7 @@ export function validate_account_name_with_memo(name, memo) {
...
@@ -67,7 +62,7 @@ export function validate_account_name_with_memo(name, memo) {
}
}
export
function
validate_memo_field
(
value
,
username
,
memokey
)
{
export
function
validate_memo_field
(
value
,
username
,
memokey
)
{
value
=
value
.
split
(
'
'
).
filter
((
v
)
=>
v
!=
''
);
value
=
value
.
split
(
'
'
).
filter
((
v
)
=>
v
!=
=
''
);
for
(
const
w
in
value
)
{
for
(
const
w
in
value
)
{
// Only perform key tests if it might be a key, i.e. it is a long string.
// Only perform key tests if it might be a key, i.e. it is a long string.
if
(
value
[
w
].
length
>=
39
)
{
if
(
value
[
w
].
length
>=
39
)
{
...
@@ -77,12 +72,7 @@ export function validate_memo_field(value, username, memokey) {
...
@@ -77,12 +72,7 @@ export function validate_memo_field(value, username, memokey) {
if
(
PrivateKey
.
isWif
(
value
[
w
]))
{
if
(
PrivateKey
.
isWif
(
value
[
w
]))
{
return
tt
(
'
chainvalidation_js.memo_is_privatekey
'
);
return
tt
(
'
chainvalidation_js.memo_is_privatekey
'
);
}
}
if
(
if
(
memokey
===
PrivateKey
.
fromSeed
(
username
+
'
memo
'
+
value
[
w
]).
toPublicKey
().
toString
())
{
memokey
===
PrivateKey
.
fromSeed
(
username
+
'
memo
'
+
value
[
w
])
.
toPublicKey
()
.
toString
()
)
{
return
tt
(
'
chainvalidation_js.memo_is_password
'
);
return
tt
(
'
chainvalidation_js.memo_is_password
'
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment