I have a login page Mayan EDMS that's running on django. You would usually login by entering username and password and clicking on the login button. What I need to achieve instead is from my server side which is running on sailsjs to post this username and password. How can I do This?
This is what I tried but received a 403 Forbidden message.
$.post({
Url: "https://mayan/authentication/login/",
Data:"username=admin&password=mypass&next=/",
Success: function(data){
Console.log(data);
}
});
As i understand it, a csrf token is required, so what i did was to disable the csrf token authentication using "csrf_excempt" in urls.py as suggested by this post: How to exempt CSRF Protection on direct_to_template
I modified it to "url(r'^login/&', csrf_exempt(login_view), name='login_view')", but when I tried posting the username and password I still get the 403 forbidden. So i am confused, is this correct? Am i only excepting csrf on the login view? Or do i need to somehow exempt the login function or something like that? I have zero knowledge on how python works and struggling to find out.