Commit 4df4ea89 authored by Ray Schamp's avatar Ray Schamp

Show an error to logged out users

When logged out users visit the complete registration view, show them an error rather than a spinner.
parent 61e21f6b
...@@ -90,18 +90,18 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({ ...@@ -90,18 +90,18 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
var demographicsDescription = this.props.intl.formatMessage({ var demographicsDescription = this.props.intl.formatMessage({
id: 'registration.studentPersonalStepDescription'}); id: 'registration.studentPersonalStepDescription'});
var registrationErrors = this.state.registrationErrors; var registrationErrors = this.state.registrationErrors;
var sessionFetched = this.props.session.status === sessionStatus.FETCHED; if (this.props.session.status === sessionStatus.FETCHED && !(
if (sessionFetched && this.props.session.session.permissions &&
!(this.props.session.session.permissions.student && this.props.session.session.permissions.student &&
this.props.session.session.flags.must_complete_registration)) { this.props.session.session.flags.must_complete_registration)
) {
registrationErrors = { registrationErrors = {
__all__: this.props.intl.formatMessage({id: 'registration.mustBeNewStudent'}) __all__: this.props.intl.formatMessage({id: 'registration.mustBeNewStudent'})
}; };
} }
return ( return (
<Deck className="student-registration"> <Deck className="student-registration">
{sessionFetched && this.state.classroom ? {registrationErrors ? (
(registrationErrors ?
<Steps.RegistrationError> <Steps.RegistrationError>
<ul> <ul>
{Object.keys(registrationErrors).map(function (field) { {Object.keys(registrationErrors).map(function (field) {
...@@ -113,7 +113,10 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({ ...@@ -113,7 +113,10 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
})} })}
</ul> </ul>
</Steps.RegistrationError> </Steps.RegistrationError>
: ) : (
this.state.waiting || !this.state.classroom ? (
<Spinner />
) : (
<Progression {... this.state}> <Progression {... this.state}>
<Steps.ClassInviteStep classroom={this.state.classroom} <Steps.ClassInviteStep classroom={this.state.classroom}
messages={this.props.messages} messages={this.props.messages}
...@@ -134,9 +137,7 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({ ...@@ -134,9 +137,7 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
waiting={this.state.waiting} /> waiting={this.state.waiting} />
</Progression> </Progression>
) )
: )}
<Spinner />
}
</Deck> </Deck>
); );
} }
......
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