Skip to content

Commit

Permalink
#49 Support Drupal 8.2 user login.
Browse files Browse the repository at this point in the history
  • Loading branch information
signalpoint committed Dec 5, 2016
1 parent e67f870 commit 3e5fc1e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/includes/rest.inc.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,22 @@ jDrupal.userLogin = function(name, pass) {
service: 'user',
resource: 'login'
};
req.open('POST', jDrupal.restPath() + 'user/login');
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
req.open('POST', jDrupal.restPath() + 'user/login?_format=json');
req.setRequestHeader('Content-type', 'application/json');
var connected = function() { jDrupal.connect().then(resolve); };
req.onload = function() {
if (req.status == 200 || req.status == 303) {
if (req.status == 200) {
var invoke = jDrupal.moduleInvokeAll('rest_post_process', req);
if (!invoke) { connected(); }
else { invoke.then(connected); }
}
else { reject(Error(req.statusText)); }
};
req.onerror = function() { reject(Error("Network Error")); };
var data = 'name=' + encodeURIComponent(name) +
'&pass=' + encodeURIComponent(pass) +
'&form_id=user_login_form';
req.send(data);
req.send(JSON.stringify({
name: name,
pass: pass
}));
});
};

Expand Down

0 comments on commit 3e5fc1e

Please sign in to comment.