diff --git a/src/l10n.json b/src/l10n.json
index 28dc656c8..c55cb851f 100644
--- a/src/l10n.json
+++ b/src/l10n.json
@@ -111,7 +111,9 @@
"registration.choosePasswordStepDescription": "Type in a new password for your account. You will use this password the next time you log into Scratch.",
"registration.choosePasswordStepTitle": "Create a password",
"registration.choosePasswordStepTooltip": "Don't use your name or anything that's easy for someone else to guess.",
- "registration.classroomInviteStepDescription": "you have been invited to join the class:",
+ "registration.classroomApiGeneralError": "Sorry, we could not find the registration information for this class",
+ "registration.classroomInviteExistingStudentStepDescription": "you have been invited to join the class:",
+ "registration.classroomInviteNewStudentStepDescription": "has invited you to join the class:",
"registration.confirmYourEmail": "Confirm Your Email",
"registration.confirmYourEmailDescription": "If you haven't already, please click the link in the confirmation email sent to:",
"registration.createUsername": "Create a Username",
diff --git a/src/views/studentcompleteregistration/studentcompleteregistration.jsx b/src/views/studentcompleteregistration/studentcompleteregistration.jsx
index d0ba8dd65..50df16443 100644
--- a/src/views/studentcompleteregistration/studentcompleteregistration.jsx
+++ b/src/views/studentcompleteregistration/studentcompleteregistration.jsx
@@ -34,19 +34,16 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
});
},
componentDidUpdate: function (prevProps) {
- if (prevProps.session.session !== this.props.session.session &&
- this.props.session.session.permissions &&
- this.props.session.session.permissions.student) {
- var classroomId = this.props.session.session.user.classroomId;
+ if (prevProps.studentUsername !== this.props.studentUsername && this.props.newStudent) {
this.setState({waiting: true});
api({
- uri: '/classrooms/' + classroomId
+ uri: '/classrooms/' + this.props.classroomId
}, function (err, body, res) {
this.setState({waiting: false});
if (err || res.statusCode !== 200) {
return this.setState({
registrationErrors: {
- __all__: this.props.intl.formatMessage({id: 'studentRegistration.classroomApiGeneralError'})
+ __all__: this.props.intl.formatMessage({id: 'registration.classroomApiGeneralError'})
}
});
}
@@ -80,7 +77,7 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
country: formData.user.country,
is_robot: formData.user.isRobot
};
- if (this.props.session.session.flags.must_reset_password) {
+ if (this.props.must_reset_password) {
submittedData.password = formData.user.password;
}
api({
@@ -103,11 +100,7 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
var demographicsDescription = this.props.intl.formatMessage({
id: 'registration.studentPersonalStepDescription'});
var registrationErrors = this.state.registrationErrors;
- if (this.props.session.status === sessionStatus.FETCHED && !(
- this.props.session.session.permissions &&
- this.props.session.session.permissions.student &&
- this.props.session.session.flags.must_complete_registration)
- ) {
+ if (!this.props.newStudent) {
registrationErrors = {
__all__: this.props.intl.formatMessage({id: 'registration.mustBeNewStudent'})
};
@@ -131,12 +124,12 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
) : (
-
- {this.props.session.session.flags.must_reset_password ?
+ {this.props.must_reset_password ?
@@ -159,7 +152,14 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
var mapStateToProps = function (state) {
return {
- session: state.session
+ classroomId: state.session.session.user && state.session.session.user.classroomId,
+ must_reset_password: state.session.session.flags && state.session.session.flags.must_reset_password,
+ newStudent: (
+ state.session.session.permissions &&
+ state.session.session.permissions.student &&
+ state.session.session.flags.must_complete_registration),
+ sessionFetched: state.session.status === sessionStatus.FETCHED,
+ studentUsername: state.session.session.user && state.session.session.user.username
};
};
diff --git a/src/views/studentregistration/l10n.json b/src/views/studentregistration/l10n.json
deleted file mode 100644
index ede12528d..000000000
--- a/src/views/studentregistration/l10n.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "studentRegistration.classroomApiGeneralError": "Sorry, we could not find the registration information for this class"
-}
diff --git a/src/views/studentregistration/studentregistration.jsx b/src/views/studentregistration/studentregistration.jsx
index 142c4f65c..5400b11d6 100644
--- a/src/views/studentregistration/studentregistration.jsx
+++ b/src/views/studentregistration/studentregistration.jsx
@@ -44,7 +44,7 @@ var StudentRegistration = intl.injectIntl(React.createClass({
if (err) {
return this.setState({
registrationError: this.props.intl.formatMessage({
- id: 'studentRegistration.classroomApiGeneralError'
+ id: 'registration.classroomApiGeneralError'
})
});
}
@@ -106,9 +106,9 @@ var StudentRegistration = intl.injectIntl(React.createClass({
:
-
+