mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
Merge pull request #1110 from rschamp/bugfix/fallback-registration-error
Provide fallback error messages
This commit is contained in:
commit
2539c4cf63
4 changed files with 24 additions and 8 deletions
|
@ -110,6 +110,7 @@
|
|||
"registration.choosePasswordStepTitle": "Create a password",
|
||||
"registration.choosePasswordStepTooltip": "Don't use your name or anything that's easy for someone else to guess.",
|
||||
"registration.classroomApiGeneralError": "Sorry, we could not find the registration information for this class",
|
||||
"registration.generalError": "Sorry, an unexpected error occurred.",
|
||||
"registration.classroomInviteExistingStudentStepDescription": "you have been invited to join the class:",
|
||||
"registration.classroomInviteNewStudentStepDescription": "has invited you to join the class:",
|
||||
"registration.confirmYourEmail": "Confirm Your Email",
|
||||
|
|
|
@ -86,11 +86,18 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
|
|||
method: 'post',
|
||||
useCsrf: true,
|
||||
formData: submittedData
|
||||
}, function (err, body) {
|
||||
}, function (err, body, res) {
|
||||
this.setState({waiting: false});
|
||||
if (err) return this.setState({registrationError: err});
|
||||
if (body.success) return this.advanceStep(formData);
|
||||
this.setState({registrationErrors: body.errors});
|
||||
this.setState({
|
||||
registrationErrors:
|
||||
body.errors || {
|
||||
__all__:
|
||||
this.props.intl.formatMessage({id: 'registration.generalError'}) +
|
||||
' (' + res.statusCode + ')'
|
||||
}
|
||||
});
|
||||
}.bind(this));
|
||||
},
|
||||
goToClass: function () {
|
||||
|
|
|
@ -78,11 +78,15 @@ var StudentRegistration = intl.injectIntl(React.createClass({
|
|||
classroom_id: this.props.classroomId,
|
||||
classroom_token: this.props.classroomToken
|
||||
}
|
||||
}, function (err, res) {
|
||||
}, function (err, body, res) {
|
||||
this.setState({waiting: false});
|
||||
if (err) return this.setState({registrationError: err});
|
||||
if (res[0].success) return this.advanceStep(formData);
|
||||
this.setState({registrationError: res[0].msg});
|
||||
if (body[0].success) return this.advanceStep(formData);
|
||||
this.setState({
|
||||
registrationError:
|
||||
body[0].msg ||
|
||||
this.props.intl.formatMessage({id: 'registration.generalError'}) + ' (' + res.statusCode + ')'
|
||||
});
|
||||
}.bind(this));
|
||||
},
|
||||
goToClass: function () {
|
||||
|
|
|
@ -66,14 +66,18 @@ var TeacherRegistration = React.createClass({
|
|||
address_zip: this.state.formData.address.zip,
|
||||
how_use_scratch: this.state.formData.useScratch
|
||||
}
|
||||
}, function (err, res) {
|
||||
}, function (err, body, res) {
|
||||
this.setState({waiting: false});
|
||||
if (err) return this.setState({registrationError: err});
|
||||
if (res[0].success) {
|
||||
if (body[0].success) {
|
||||
this.props.dispatch(sessionActions.refreshSession());
|
||||
return this.advanceStep(formData);
|
||||
}
|
||||
this.setState({registrationError: res[0].msg});
|
||||
this.setState({
|
||||
registrationError:
|
||||
body[0].msg ||
|
||||
this.props.intl.formatMessage({id: 'registration.generalError'}) + ' (' + res.statusCode + ')'
|
||||
});
|
||||
}.bind(this));
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue