1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Updated validation to avoid saving masked fields.

This commit is contained in:
blkmutt 2014-04-13 21:54:01 -04:00
parent a7e0ca0d60
commit 33b90241a2

View File

@ -483,6 +483,11 @@ class AccountController extends \BaseController {
private function savePayments()
{
Validator::extend('notmasked', function($attribute, $value, $parameters)
{
return $value != str_repeat('*', strlen($value));
});
$rules = array();
$recommendedId = Input::get('recommendedGateway_id');
@ -502,14 +507,12 @@ class AccountController extends \BaseController {
{
if(in_array($field, ['merchant_id', 'passCode']))
{
$rules[$gateway->id.'_'.$field] = 'required';
$rules[$gateway->id.'_'.$field] = 'match:/?![*]+/';
$rules[$gateway->id.'_'.$field] = 'required|notmasked';
}
}
else
{
$rules[$gateway->id.'_'.$field] = 'required';
$rules[$gateway->id.'_'.$field] = 'match:/?![*]+/';
$rules[$gateway->id.'_'.$field] = 'required|notmasked';
}
}
}