mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Check for username before sending
the `//` for an empty username that gets sent to the backend causes a 500 error. This is an edge case in formsy, as it has not detected a change value yet, so handle it in the username validation method. Fixes #872
This commit is contained in:
parent
07d7750b9c
commit
ffa249c3c5
1 changed files with 7 additions and 0 deletions
|
@ -91,6 +91,13 @@ module.exports = {
|
||||||
},
|
},
|
||||||
validateUsername: function (username, callback) {
|
validateUsername: function (username, callback) {
|
||||||
callback = callback || function () {};
|
callback = callback || function () {};
|
||||||
|
if (username.length < 1) {
|
||||||
|
this.refs.form.refs.formsy.updateInputsWithError({
|
||||||
|
'user.username': formatMessage({id: 'teacherRegistration.validationRequired'})
|
||||||
|
});
|
||||||
|
return callback(false);
|
||||||
|
}
|
||||||
|
|
||||||
api({
|
api({
|
||||||
host: '',
|
host: '',
|
||||||
uri: '/accounts/check_username/' + username + '/'
|
uri: '/accounts/check_username/' + username + '/'
|
||||||
|
|
Loading…
Reference in a new issue