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 @@ ...@@ -35,7 +35,7 @@
.intel { .intel {
img { img {
max-height: 50px max-height: 50px;
} }
} }
} }
......
...@@ -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) {
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
padding-top: 5px; padding-top: 5px;
font-weight: bold; font-weight: bold;
} }
.right { .right {
float: right; float: right;
} }
.spinner { .spinner {
margin: 0 .8rem; margin: 0 .8rem;
width: 1rem; width: 1rem;
......
...@@ -233,6 +233,7 @@ module.exports = { ...@@ -233,6 +233,7 @@ module.exports = {
ChoosePasswordStep: intl.injectIntl(React.createClass({ ChoosePasswordStep: intl.injectIntl(React.createClass({
getDefaultProps: function () { getDefaultProps: function () {
return { return {
username: null,
showPassword: false, showPassword: false,
waiting: false waiting: false
}; };
...@@ -264,7 +265,7 @@ module.exports = { ...@@ -264,7 +265,7 @@ module.exports = {
validations={{ validations={{
minLength: 6, minLength: 6,
notEquals: 'password', notEquals: 'password',
notEqualsField: 'user.username' notEqualsUsername: this.props.username
}} }}
validationErrors={{ validationErrors={{
minLength: formatMessage({ minLength: formatMessage({
...@@ -273,7 +274,7 @@ module.exports = { ...@@ -273,7 +274,7 @@ module.exports = {
notEquals: formatMessage({ notEquals: formatMessage({
id: 'registration.validationPasswordNotEquals' id: 'registration.validationPasswordNotEquals'
}), }),
notEqualsField: formatMessage({ notEqualsUsername: formatMessage({
id: 'registration.validationPasswordNotUsername' id: 'registration.validationPasswordNotUsername'
}) })
}} }}
......
...@@ -164,7 +164,7 @@ dl { ...@@ -164,7 +164,7 @@ dl {
dt { dt {
font-weight: 700; font-weight: 700;
} }
dd { dd {
margin: 0; margin: 0;
} }
......
...@@ -132,7 +132,8 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({ ...@@ -132,7 +132,8 @@ 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}
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