Using django-allauth, how do I obtain form errors via AJAX login?
I am using this view with my /signup/
url:
from allauth.account.views import SignupView
Conveniently, it accepts my Ajax call:
var signupForm = function(token) {
$.ajax({ url:"/signup/",
type:"POST",
data: {
"email": $('#user').val(),
"password1": $('#pass1').val(),
"password2": $('#pass2').val()
},
success: function (){
location.href = '/';
window.location.reload(true);
},
error:function (er) {
alert("signup failure...",er);
}
});
};
Inconveniently, if there is a problem with the form, it returns:
error 400: Bad Request
This gives me no idea why a login has failed. I would like to be able to convey to the user what happened. Was it a problem with her password? Was her email address already registered?
Can I accomplish this with all-auth, or do I need to write my own validation from javascript?