Commit 8f5f89ab authored by Ben Wheeler's avatar Ben Wheeler

improve email step in several ways

parent 7d17dc5d
...@@ -25,4 +25,9 @@ ...@@ -25,4 +25,9 @@
outline: none; outline: none;
} }
} }
&::placeholder {
font-style: italic;
color: $type-gray-75percent;
}
} }
@import "../../colors";
@import "../../frameless";
.input::placeholder {
font-style: italic;
color: $type-gray-75percent;
}
...@@ -17,12 +17,12 @@ class EmailStep extends React.Component { ...@@ -17,12 +17,12 @@ class EmailStep extends React.Component {
super(props); super(props);
bindAll(this, [ bindAll(this, [
'handleValidSubmit', 'handleValidSubmit',
'validateEmailIfPresent', 'validateEmail',
'validateForm' 'validateForm'
]); ]);
} }
validateEmailIfPresent (email) { validateEmail (email) {
if (!email) return null; // skip validation if email is blank; null indicates valid if (!email) return this.props.intl.formatMessage({id: 'general.required'});
const isValidLocally = emailValidator.validate(email); const isValidLocally = emailValidator.validate(email);
if (isValidLocally) { if (isValidLocally) {
return null; // TODO: validate email address remotely return null; // TODO: validate email address remotely
...@@ -51,6 +51,7 @@ class EmailStep extends React.Component { ...@@ -51,6 +51,7 @@ class EmailStep extends React.Component {
errors, errors,
handleSubmit, handleSubmit,
isSubmitting, isSubmitting,
setFieldError,
validateField validateField
} = props; } = props;
return ( return (
...@@ -89,9 +90,12 @@ class EmailStep extends React.Component { ...@@ -89,9 +90,12 @@ class EmailStep extends React.Component {
id="email" id="email"
name="email" name="email"
placeholder={this.props.intl.formatMessage({id: 'general.emailAddress'})} placeholder={this.props.intl.formatMessage({id: 'general.emailAddress'})}
validate={this.validateEmailIfPresent} validate={this.validateEmail}
validationClassName="validation-full-width-input" validationClassName="validation-full-width-input"
onBlur={() => validateField('email')} // eslint-disable-line react/jsx-no-bind /* eslint-disable react/jsx-no-bind */
onBlur={() => validateField('email')}
onFocus={() => setFieldError('email', null)}
/* eslint-enable react/jsx-no-bind */
/> />
</JoinFlowStep> </JoinFlowStep>
); );
......
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
"registration.studentUsernameStepHelpText": "Already have a Scratch account?", "registration.studentUsernameStepHelpText": "Already have a Scratch account?",
"registration.studentUsernameStepTooltip": "You'll need to create a new Scratch account to join this class.", "registration.studentUsernameStepTooltip": "You'll need to create a new Scratch account to join this class.",
"registration.studentUsernameFieldHelpText": "For safety, don't use your real name!", "registration.studentUsernameFieldHelpText": "For safety, don't use your real name!",
"registration.acceptTermsOfUse": "By creating an account, I accept and agree to the {touLink}.", "registration.acceptTermsOfUse": "By creating an account, you accept and agree to the {touLink}.",
"registration.usernameStepTitle": "Request a Teacher Account", "registration.usernameStepTitle": "Request a Teacher Account",
"registration.usernameStepTitleScratcher": "Create a Scratch Account", "registration.usernameStepTitleScratcher": "Create a Scratch Account",
"registration.validationMaxLength": "Sorry, you have exceeded the maximum character limit.", "registration.validationMaxLength": "Sorry, you have exceeded the maximum character limit.",
......
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