adding piece of javascript to display custom ppolicy messages

This commit is contained in:
kakwa 2015-11-02 23:24:35 +01:00
parent 451c59e875
commit 27e05ac7f2
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
$('#form').validator({
custom: {
'ppolicy': function($el) {
var $ret = 'PPolicy error';
$.ajax({
url: '/checkppolicy',
dataType: 'json',
async: false,
data: 'pwd=' + $el.val(),
success: function(data) {
$ret = data;
}
});
this.options.errors['ppolicy'] = $ret['reason'];
return $ret['match'];
}
},
errors: {
'ppolicy': 'PPolicy error',
}
})