jbeuckm / drupal-client

Javascript client for Drupal Services
32 stars 10 forks source link

SMTP Parse Error when registering user with non-existent email #23

Open max1020 opened 9 years ago

max1020 commented 9 years ago

When using the drupal smtp module, i always got a parse error when i registered a new user with an email that did not exist. the account was created, but the error message was always visible on the device and the simulator.

the responseText from the SMTP module looks like this:

SMTP Error: The following recipients failed: editor16@caramba.net\n{"uid":"99","uri":"http://carmaba.rhcloud.com/rest/v1/user/99"}

some hacky fix in the makeRequest function (from lines 296):

xhr.onload = function () {

    if (xhr.status === 200) {
        // console.log("xhr.responseText " + xhr.responseText);
        if (xhr.responseText.lastIndexOf("SMTP Error",0) === 0) {
            success(responseData);
        } else {
            var responseData = JSON.parse(xhr.responseText);
            success(responseData);
        }
    } else {
        console.log('makeRequest returned with status ' + xhr.status);
        failure(xhr.responseText);
    }
};