From d1f73c3ef47d14a16ee75b6cdfc82d08c8c719b0 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 27 Jul 2016 10:24:37 -0400 Subject: [PATCH 1/2] Redesign invite step, add option to log out Resolves #752 --- src/components/registration/steps.jsx | 10 +++++++--- src/components/registration/steps.scss | 9 +++++++++ src/l10n.json | 4 +++- .../studentcompleteregistration.jsx | 16 +++++++++++++++- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/components/registration/steps.jsx b/src/components/registration/steps.jsx index 216cb7e5f..831141170 100644 --- a/src/components/registration/steps.jsx +++ b/src/components/registration/steps.jsx @@ -809,6 +809,9 @@ module.exports = { ClassInviteStep: intl.injectIntl(React.createClass({ getDefaultProps: function () { return { + classroom: null, + onHandleLogOut: function () {}, + studentUsername: null, waiting: false }; }, @@ -822,9 +825,7 @@ module.exports = { {this.props.waiting ? [ ] : [ - , -

{this.props.classroom.educator.username}

, +

{this.props.studentUsername}

,

{formatMessage({id: 'registration.classroomInviteStepDescription'})}

, @@ -832,11 +833,14 @@ module.exports = {

{this.props.classroom.title}

+

{formatMessage({id: 'registration.invitedBy'})}

+

{this.props.classroom.educator.username}

, +

{formatMessage({id: 'registration.notYou'})}

, ]} diff --git a/src/components/registration/steps.scss b/src/components/registration/steps.scss index e1676306b..f2da547db 100644 --- a/src/components/registration/steps.scss +++ b/src/components/registration/steps.scss @@ -29,6 +29,15 @@ color: $ui-dark-gray; } + &.class-invite-step { + text-align: center; + + > p a { + text-decoration: underline; + color: $ui-white; + font-weight: inherit; + } + } &.class-invite-step, &.class-welcome-step { diff --git a/src/l10n.json b/src/l10n.json index 80c0e4a29..28dc656c8 100644 --- a/src/l10n.json +++ b/src/l10n.json @@ -111,17 +111,19 @@ "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": "has invited you to join the class:", + "registration.classroomInviteStepDescription": "you have been invited 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", "registration.goToClass": "Go to Class", + "registration.invitedBy": "invited by", "registration.lastStepTitle": "Thank you for requesting a Scratch Teacher Account", "registration.lastStepDescription": "We are currently processing your application. ", "registration.mustBeNewStudent": "You must be a new student to complete your registration", "registration.nameStepTooltip": "This information is used for verification and to aggregate usage statistics.", "registration.newPassword": "New Password", "registration.nextStep": "Next Step", + "registration.notYou": "Not you? Log in as another user", "registration.personalStepTitle": "Personal Information", "registration.personalStepDescription": "Your individual responses will not be displayed publicly, and will be kept confidential and secure", "registration.studentPersonalStepDescription": "This information will not appear on the Scratch website.", diff --git a/src/views/studentcompleteregistration/studentcompleteregistration.jsx b/src/views/studentcompleteregistration/studentcompleteregistration.jsx index 76c58101b..d0ba8dd65 100644 --- a/src/views/studentcompleteregistration/studentcompleteregistration.jsx +++ b/src/views/studentcompleteregistration/studentcompleteregistration.jsx @@ -6,6 +6,7 @@ var render = require('../../lib/render.jsx'); var sessionStatus = require('../../redux/session').Status; var api = require('../../lib/api'); var intl = require('../../lib/intl.jsx'); +var log = require('../../lib/log.js'); var Deck = require('../../components/deck/deck.jsx'); var Progression = require('../../components/progression/progression.jsx'); @@ -53,6 +54,18 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({ }.bind(this)); } }, + handleLogOut: function (e) { + e.preventDefault(); + api({ + host: '', + method: 'post', + uri: '/accounts/logout/', + useCsrf: true + }, function (err) { + if (err) return log.error(err); + window.location = '/'; + }.bind(this)); + }, register: function (formData) { this.setState({waiting: true}); formData = defaults({}, formData || {}, this.state.formData); @@ -119,8 +132,9 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({ ) : ( {this.props.session.session.flags.must_reset_password ? Date: Wed, 27 Jul 2016 14:12:55 -0400 Subject: [PATCH 2/2] Lint --- src/components/registration/steps.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/registration/steps.jsx b/src/components/registration/steps.jsx index 831141170..d5d9620fa 100644 --- a/src/components/registration/steps.jsx +++ b/src/components/registration/steps.jsx @@ -6,7 +6,6 @@ var intl = require('../../lib/intl.jsx'); var log = require('../../lib/log'); var smartyStreets = require('../../lib/smarty-streets'); -var Avatar = require('../../components/avatar/avatar.jsx'); var Button = require('../../components/forms/button.jsx'); var Card = require('../../components/card/card.jsx'); var CharCount = require('../../components/forms/charcount.jsx');