Commit e915ae19 authored by Ben Wheeler's avatar Ben Wheeler

if username has spaces, provide validation message specifically mentioning that

parent 23c799dd
......@@ -230,6 +230,7 @@
"registration.validationUsernameNotAllowed": "Username not allowed",
"registration.validationUsernameVulgar": "Hmm, that looks inappropriate",
"registration.validationUsernameInvalid": "Invalid username",
"registration.validationUsernameSpaces": "Usernames can't have spaces",
"registration.validationEmailInvalid": "Email doesn’t look right. Try another?",
"registration.waitForApproval": "Wait for Approval",
"registration.waitForApprovalDescription": "You can log into your Scratch Account now, but the features specific to Teachers are not yet available. Your information is being reviewed. Please be patient, the approval process can take up to one day. You will receive an email indicating your account has been upgraded once your account has been approved.",
......
......@@ -9,6 +9,8 @@ module.exports.validateUsernameLocally = username => {
return {valid: false, errMsgId: 'registration.validationUsernameMinLength'};
} else if (username.length > 20) {
return {valid: false, errMsgId: 'registration.validationUsernameMaxLength'};
} else if (/\s/i.test(username)) {
return {valid: false, errMsgId: 'registration.validationUsernameSpaces'};
} else if (!/^[\w-]+$/i.test(username)) {
return {valid: false, errMsgId: 'registration.validationUsernameRegexp'};
}
......
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