Giter Site home page Giter Site logo

Comments (6)

perrytew avatar perrytew commented on September 21, 2024

Dan,
I don't think it's a bug. It's more of a legacy feature we're working with. Please check the result for an "errors" array and you should see the "missing" messages. We did that for a few reasons. I agree that the 200 for a failed login is inappropriate, but it works really well with frameworks like backbone.js when you have views keying off changes in the cart.errors property.

Thanks,
Perry

from responsive_checkout.

WriterDanGaidin avatar WriterDanGaidin commented on September 21, 2024

Ah, sorry. I obviously didn't communicate myself well enough. I'm not getting any errors back at all. It's not the 200 that I'm suggesting is inappropriate (I think that's perfectly fine given what you're trying to accomplish with this api call). The issue is that the errors array inside the result is equal to null when I send a request that has empty values for email and password.

I get appropriate errors passed back to me (within the result's errors array) if either the email or the password are blank, but it comes back errorless if both the email and password are blank.

from responsive_checkout.

perrytew avatar perrytew commented on September 21, 2024

Hmmm, I've reviewed the code. Are you passing in nulls or empty string? Perchance you could post me the snippet of your call?

from responsive_checkout.

WriterDanGaidin avatar WriterDanGaidin commented on September 21, 2024

Empty strings. I've checked the cart object prior to sending the request to verify this. Here's my code:

app.data.cart.set({
    'email' : jQuery.trim(jQuery('#email').val())
});
app.data.cart.set({
    'password' : jQuery.trim(jQuery('#myMemberAccountPassword').val())
});
jQuery.ajax({
    url : '/rest/cart/login',
    type : 'POST', // Notice
    async : false,
    headers : {
        "cache-control" : "no-cache"
    },
    contentType : 'application/json; charset=UTF-8',
    data : JSON.stringify(app.data.cart),
    dataType : 'json'
}).done(function(loggedInCart) {
    if(loggedInCart.errors && loggedInCart.errors.length) { // Log-in errors
        app.commonFunctions.displayCheckoutErrors(loggedInCart.errors);
        console.log(loggedInCart.errors);
    } else { // Customer logged in successfully
        app.data.cart.set(loggedInCart, {silent: true});
                app.data.cart.trigger('sync');
    }
});

from responsive_checkout.

perrytew avatar perrytew commented on September 21, 2024

Dan,
The code was checking for nulls, not empty strings. ProdSupport pushed a fix to check for both. Would you kindly run your test again and report the results?

Thanks.

from responsive_checkout.

WriterDanGaidin avatar WriterDanGaidin commented on September 21, 2024

Bingo. :) Thanks.

from responsive_checkout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.