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
537104c5
Commit
537104c5
authored
Aug 12, 2016
by
Matthew Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add username validation to student complete registration
Fixes #760
parent
2fc62cba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
src/components/forms/validations.jsx
src/components/forms/validations.jsx
+1
-0
src/components/registration/steps.jsx
src/components/registration/steps.jsx
+8
-3
src/views/studentcompleteregistration/studentcompleteregistration.jsx
...udentcompleteregistration/studentcompleteregistration.jsx
+5
-1
No files found.
src/components/forms/validations.jsx
View file @
537104c5
...
@@ -23,6 +23,7 @@ module.exports.validations = {
...
@@ -23,6 +23,7 @@ module.exports.validations = {
return
phoneNumberUtil
.
isValidNumber
(
parsed
);
return
phoneNumberUtil
.
isValidNumber
(
parsed
);
}
}
};
};
module
.
exports
.
validations
.
notEqualsUsername
=
module
.
exports
.
validations
.
notEquals
;
module
.
exports
.
validationHOCFactory
=
function
(
defaultValidationErrors
)
{
module
.
exports
.
validationHOCFactory
=
function
(
defaultValidationErrors
)
{
return
function
(
Component
)
{
return
function
(
Component
)
{
...
...
src/components/registration/steps.jsx
View file @
537104c5
...
@@ -226,6 +226,7 @@ module.exports = {
...
@@ -226,6 +226,7 @@ module.exports = {
ChoosePasswordStep
:
intl
.
injectIntl
(
React
.
createClass
({
ChoosePasswordStep
:
intl
.
injectIntl
(
React
.
createClass
({
getDefaultProps
:
function
()
{
getDefaultProps
:
function
()
{
return
{
return
{
studentUsername
:
null
,
showPassword
:
false
,
showPassword
:
false
,
waiting
:
false
waiting
:
false
};
};
...
@@ -257,7 +258,7 @@ module.exports = {
...
@@ -257,7 +258,7 @@ module.exports = {
validations=
{
{
validations=
{
{
minLength
:
6
,
minLength
:
6
,
notEquals
:
'
password
'
,
notEquals
:
'
password
'
,
notEquals
Field
:
'
user.username
'
notEquals
Username
:
this
.
props
.
studentUsername
}
}
}
}
validationErrors=
{
{
validationErrors=
{
{
minLength
:
formatMessage
({
minLength
:
formatMessage
({
...
@@ -266,7 +267,7 @@ module.exports = {
...
@@ -266,7 +267,7 @@ module.exports = {
notEquals
:
formatMessage
({
notEquals
:
formatMessage
({
id
:
'
registration.validationPasswordNotEquals
'
id
:
'
registration.validationPasswordNotEquals
'
}),
}),
notEquals
Field
:
formatMessage
({
notEquals
Username
:
formatMessage
({
id
:
'
registration.validationPasswordNotUsername
'
id
:
'
registration.validationPasswordNotUsername
'
})
})
}
}
}
}
...
@@ -879,7 +880,11 @@ module.exports = {
...
@@ -879,7 +880,11 @@ module.exports = {
};
};
},
},
onNextStep
:
function
()
{
onNextStep
:
function
()
{
this
.
props
.
onNextStep
();
this
.
props
.
onNextStep
({
user
:
{
username
:
this
.
props
.
studentUsername
}
});
},
},
render
:
function
()
{
render
:
function
()
{
var
formatMessage
=
this
.
props
.
intl
.
formatMessage
;
var
formatMessage
=
this
.
props
.
intl
.
formatMessage
;
...
...
src/views/studentcompleteregistration/studentcompleteregistration.jsx
View file @
537104c5
...
@@ -132,7 +132,11 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
...
@@ -132,7 +132,11 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
{
this
.
props
.
must_reset_password
?
{
this
.
props
.
must_reset_password
?
<
Steps
.
ChoosePasswordStep
onNextStep=
{
this
.
advanceStep
}
<
Steps
.
ChoosePasswordStep
onNextStep=
{
this
.
advanceStep
}
showPassword=
{
true
}
showPassword=
{
true
}
waiting=
{
this
.
state
.
waiting
}
/>
waiting=
{
this
.
state
.
waiting
}
studentUsername=
{
this
.
state
.
formData
.
user
&&
this
.
state
.
formData
.
user
.
username
}
/>
:
:
[]
[]
}
}
...
...
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