lundi 16 janvier 2017

How to get HTTP response code upon failed login

This is a problem I'm having with ember-simple-auth. How would I get a http response code when a fail login occurs rather than using the token error message. I'm using the drf-token and this is the snippet of the code that uses the token and if there's an error base then it refocuses the password field. I would like to use http response.

this.get('session').authenticate('authenticator:drf-token', username, password).catch((response) => {
                if (response && response.errors && response.errors.base) {
                    this.set('loginErrorMessage', response.errors.base[0]);
                    run.schedule('afterRender', this, function() {
                            $('input[name=password]').focus();
                    });




Aucun commentaire:

Enregistrer un commentaire