2015-11-02 23:24:35 +01:00
|
|
|
$('#form').validator({
|
|
|
|
custom: {
|
|
|
|
'ppolicy': function($el) {
|
2016-07-05 19:57:35 +02:00
|
|
|
if(! $el.prop('required') && $el.val() == 0){
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
var $ret = 'PPolicy error';
|
|
|
|
$.ajax({
|
2019-07-10 11:58:08 +02:00
|
|
|
url: './checkppolicy',
|
2016-07-05 20:02:58 +02:00
|
|
|
type: 'POST',
|
2016-07-05 19:57:35 +02:00
|
|
|
dataType: 'json',
|
|
|
|
async: false,
|
2016-07-29 23:00:16 +02:00
|
|
|
data: 'pwd=' + encodeURIComponent($el.val()),
|
2016-07-05 19:57:35 +02:00
|
|
|
success: function(data) {
|
2015-11-02 23:24:35 +01:00
|
|
|
$ret = data;
|
2016-07-29 23:00:16 +02:00
|
|
|
},
|
|
|
|
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};
|
|
|
|
}
|
2016-07-05 19:57:35 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
this.options.errors['ppolicy'] = $ret['reason'];
|
|
|
|
return $ret['match'];
|
|
|
|
}
|
2015-11-02 23:24:35 +01:00
|
|
|
},
|
|
|
|
errors: {
|
|
|
|
'ppolicy': 'PPolicy error',
|
|
|
|
}
|
|
|
|
})
|
2016-07-05 19:57:35 +02:00
|
|
|
|
|
|
|
// vim:set expandtab tabstop=4 shiftwidth=4:
|