Commit 59d55811 authored by Matthew Taylor's avatar Matthew Taylor Committed by GitHub

Merge pull request #836 from mewtaylor/issue/gh-760

Fix GH-760: Add username `not equals` to password validation
parents e791c0a8 f8de61f0
......@@ -35,7 +35,7 @@
.intel {
img {
max-height: 50px
max-height: 50px;
}
}
}
......
......@@ -23,6 +23,7 @@ module.exports.validations = {
return phoneNumberUtil.isValidNumber(parsed);
}
};
module.exports.validations.notEqualsUsername = module.exports.validations.notEquals;
module.exports.validationHOCFactory = function (defaultValidationErrors) {
return function (Component) {
......
......@@ -233,6 +233,7 @@ module.exports = {
ChoosePasswordStep: intl.injectIntl(React.createClass({
getDefaultProps: function () {
return {
username: null,
showPassword: false,
waiting: false
};
......@@ -264,7 +265,7 @@ module.exports = {
validations={{
minLength: 6,
notEquals: 'password',
notEqualsField: 'user.username'
notEqualsUsername: this.props.username
}}
validationErrors={{
minLength: formatMessage({
......@@ -273,7 +274,7 @@ module.exports = {
notEquals: formatMessage({
id: 'registration.validationPasswordNotEquals'
}),
notEqualsField: formatMessage({
notEqualsUsername: formatMessage({
id: 'registration.validationPasswordNotUsername'
})
}}
......
......@@ -132,7 +132,8 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
{this.props.must_reset_password ?
<Steps.ChoosePasswordStep onNextStep={this.advanceStep}
showPassword={true}
waiting={this.state.waiting} />
waiting={this.state.waiting}
username={this.props.studentUsername} />
:
[]
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment