Commit c2004d0f authored by picklesrus's avatar picklesrus

Switch to using scratchr2 check_username endpoing instead of api. There are...

Switch to using scratchr2 check_username endpoing instead of api. There are some cleanspeak differences with the api one that need to be resolved.
parent b8450100
......@@ -18,12 +18,17 @@ module.exports.validateUsernameLocally = username => {
module.exports.validateUsernameRemotely = username => (
new Promise(resolve => {
api({
uri: `/accounts/checkusername/${username}/`
host: '', // not handled by API; use existing infrastructure
uri: `/accounts/check_username/${username}/`
}, (err, body, res) => {
if (err || res.statusCode !== 200) {
resolve({requestSucceeded: false, valid: false, errMsgId: 'general.error'});
}
switch (body.msg) {
let msg = '';
if (body && body[0]) {
msg = body[0].msg;
}
switch (msg) {
case 'valid username':
resolve({requestSucceeded: true, valid: true});
break;
......
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