mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-25 02:34:31 +01:00
fix ppolicy client side javascript checker
Due to a missing encodeURIComponent, the post arguments of the http query on /checkppolicy could be interpreted as several argument if caracters like & or = were present. This commit also adds error handling on http return codes in the checker.
This commit is contained in:
parent
a84ee528aa
commit
5ff62f0a8c
@ -10,9 +10,24 @@ $('#form').validator({
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
async: false,
|
async: false,
|
||||||
data: 'pwd=' + $el.val(),
|
data: 'pwd=' + encodeURIComponent($el.val()),
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$ret = data;
|
$ret = data;
|
||||||
|
},
|
||||||
|
error: function(jqXHR, exception) {
|
||||||
|
switch (jqXHR.status) {
|
||||||
|
case 400:
|
||||||
|
$ret = {"reason":"Javascript ppolicy.js error","match":false};
|
||||||
|
break;
|
||||||
|
case 403:
|
||||||
|
$ret = {"reason":"Session expired, you must reconnect","match":false};
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
$ret = {"reason":"Server error","match":false};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$ret = {"reason":"Unknown error [" + jqXHR.status + "], check logs","match":false};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.options.errors['ppolicy'] = $ret['reason'];
|
this.options.errors['ppolicy'] = $ret['reason'];
|
||||||
|
Loading…
Reference in New Issue
Block a user