Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
7ead9d0e
Commit
7ead9d0e
authored
Aug 11, 2019
by
Ben Wheeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use updated strings in join flow
parent
ca6711e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
18 deletions
+17
-18
src/components/join-flow/country-step.jsx
src/components/join-flow/country-step.jsx
+1
-1
src/components/registration/steps.jsx
src/components/registration/steps.jsx
+1
-1
src/lib/validate.js
src/lib/validate.js
+7
-8
test/unit/lib/validate.test.js
test/unit/lib/validate.test.js
+8
-8
No files found.
src/components/join-flow/country-step.jsx
View file @
7ead9d0e
...
...
@@ -69,7 +69,7 @@ class CountryStep extends React.Component {
<
JoinFlowStep
description=
{
this
.
props
.
intl
.
formatMessage
({
id
:
'
registration.countryStepDescription
'
})
}
headerImgSrc=
"/images/hoc/getting-started.jpg"
title=
{
this
.
props
.
intl
.
formatMessage
({
id
:
'
general.joinScratch
'
})
}
title=
{
this
.
props
.
intl
.
formatMessage
({
id
:
'
registration.countryStepTitle
'
})
}
waiting=
{
isSubmitting
}
onSubmit=
{
handleSubmit
}
>
...
...
src/components/registration/steps.jsx
View file @
7ead9d0e
...
...
@@ -139,7 +139,7 @@ class UsernameStep extends React.Component {
default
:
this
.
form
.
formsy
.
updateInputsWithError
({
'
user.username
'
:
this
.
props
.
intl
.
formatMessage
({
id
:
'
registration.validationUsername
Invali
d
'
id
:
'
registration.validationUsername
NotAllowe
d
'
})
});
return
callback
(
false
);
...
...
src/lib/validate.js
View file @
7ead9d0e
...
...
@@ -5,11 +5,11 @@ module.exports.validateUsernameLocally = username => {
if
(
!
username
||
username
===
''
)
{
return
{
valid
:
false
,
errMsgId
:
'
general.required
'
};
}
else
if
(
username
.
length
<
3
)
{
return
{
valid
:
false
,
errMsgId
:
'
form
.validationUsernameMinLength
'
};
return
{
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameMinLength
'
};
}
else
if
(
username
.
length
>
20
)
{
return
{
valid
:
false
,
errMsgId
:
'
form
.validationUsernameMaxLength
'
};
return
{
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameMaxLength
'
};
}
else
if
(
!
/^
[\w
-
]
+$/i
.
test
(
username
))
{
return
{
valid
:
false
,
errMsgId
:
'
form
.validationUsernameRegexp
'
};
return
{
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameRegexp
'
};
}
return
{
valid
:
true
};
};
...
...
@@ -29,12 +29,12 @@ module.exports.validateUsernameRemotely = username => (
case
'
username exists
'
:
resolve
({
valid
:
false
,
errMsgId
:
'
registration.validationUsernameExists
'
});
break
;
case
'
bad username
'
:
resolve
({
valid
:
false
,
errMsgId
:
'
registration.validationUsername
Vulgar
'
});
case
'
bad username
'
:
// i.e., vulgar
resolve
({
valid
:
false
,
errMsgId
:
'
registration.validationUsername
NotAllowed
'
});
break
;
case
'
invalid username
'
:
default
:
resolve
({
valid
:
false
,
errMsgId
:
'
registration.validationUsername
Invali
d
'
});
resolve
({
valid
:
false
,
errMsgId
:
'
registration.validationUsername
NotAllowe
d
'
});
}
});
})
...
...
@@ -55,8 +55,7 @@ module.exports.validatePasswordConfirm = (password, passwordConfirm) => {
if
(
!
passwordConfirm
)
{
return
{
valid
:
false
,
errMsgId
:
'
general.required
'
};
}
else
if
(
password
!==
passwordConfirm
)
{
// TODO: add a new string for this case
return
{
valid
:
false
,
errMsgId
:
'
general.error
'
};
return
{
valid
:
false
,
errMsgId
:
'
registration.validationPasswordConfirmNotEquals
'
};
}
return
{
valid
:
true
};
};
test/unit/lib/validate.test.js
View file @
7ead9d0e
...
...
@@ -13,15 +13,15 @@ describe('unit test lib/validate.js', () => {
response
=
validate
.
validateUsernameLocally
(
''
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
general.required
'
});
response
=
validate
.
validateUsernameLocally
(
'
ab
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
form
.validationUsernameMinLength
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameMinLength
'
});
response
=
validate
.
validateUsernameLocally
(
'
abcdefghijklmnopqrstu
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
form
.validationUsernameMaxLength
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameMaxLength
'
});
response
=
validate
.
validateUsernameLocally
(
'
abc def
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
form
.validationUsernameRegexp
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameRegexp
'
});
response
=
validate
.
validateUsernameLocally
(
'
abc!def
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
form
.validationUsernameRegexp
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameRegexp
'
});
response
=
validate
.
validateUsernameLocally
(
'
abc😄def
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
form
.validationUsernameRegexp
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration
.validationUsernameRegexp
'
});
});
test
(
'
validate password
'
,
()
=>
{
...
...
@@ -53,10 +53,10 @@ describe('unit test lib/validate.js', () => {
response
=
validate
.
validatePasswordConfirm
(
''
,
''
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
general.required
'
});
response
=
validate
.
validatePasswordConfirm
(
'
abcdef
'
,
'
abcdefg
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
general.error
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration.validationPasswordConfirmNotEquals
'
});
response
=
validate
.
validatePasswordConfirm
(
'
abcdef
'
,
'
123456
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
general.error
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration.validationPasswordConfirmNotEquals
'
});
response
=
validate
.
validatePasswordConfirm
(
''
,
'
abcdefg
'
);
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
general.error
'
});
expect
(
response
).
toEqual
({
valid
:
false
,
errMsgId
:
'
registration.validationPasswordConfirmNotEquals
'
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment