TT#90351 - Fix /api/subscribers PATCH

* whenever webpassword was not PATCHed, the
	   request would fail because the resource would
	   have the encrypted webpassword from the DB
	   and form valdiation would complai it's too long
	 * the approach now is to remove the webpassword
	   from resource before form validation if the
	   resource has the same webpassword as the DB
	   (i.e. webpassword wasn't (PATCHed) and then
	   reassign it to the resource after form validation

Change-Id: I86fab0f4bf789bd3518a74d49daf1a0402f20125
mr9.0
Flaviu Mates 6 years ago
parent 94ef1fef2c
commit d028948f1a

@ -332,7 +332,14 @@ sub prepare_resource {
}
}
#if webpassword hasn't changed, it means that nothing has been done to it via PUT/PATCH, and it comes encrypted from the database
#so we're deleting it here for form's length validation and then reassigning it to the resource
my $webpassword;
$webpassword = delete $resource->{webpassword} if ( $resource->{webpassword} && $item &&
$resource->{webpassword} eq $item->provisioning_voip_subscriber->webpassword );
return unless &$validate_code($resource);
$resource->{webpassword} = $webpassword if ($webpassword);
#my ($form) = $self->get_form($c);
#return unless $self->validate_form(
# c => $c,

Loading…
Cancel
Save