Skip to content

Commit

Permalink
Improve error handling for csrf token check
Browse files Browse the repository at this point in the history
  • Loading branch information
djschilling committed Oct 26, 2020
1 parent 6ab85f8 commit 6a95801
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ctldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function apiPost(site, func, data, triedLogin, triedCSRFUpdate) {
}
return result.data;
}, function (error) {
if ((error.error.errors[0].message === "CSRF-Token is invalid") && !triedCSRFUpdate) {
if ((error.error && error.error.errors && error.error.errors[0] && error.error.errors[0].message === "CSRF-Token is invalid") && !triedCSRFUpdate) {
logDebug(site, "CSRF token is invalid, get new one and retry...");
return getCsrfToken(site).then(function() {
// Retry operation
Expand Down

0 comments on commit 6a95801

Please sign in to comment.