diff --git a/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm b/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm index e16bd04437..1cf103116f 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm @@ -242,11 +242,11 @@ sub update_fields { ); } - if($c->config->{security}->{password_sip_autogenerate}) { + if($c->config->{security}->{password_sip_autogenerate} || !$c->user->show_passwords) { $self->field('password')->inactive(1); $self->field('password')->required(0); } - if($c->config->{security}->{password_web_autogenerate}) { + if($c->config->{security}->{password_web_autogenerate} || !$c->user->show_passwords) { $self->field('webpassword')->inactive(1); $self->field('webpassword')->required(0); } diff --git a/lib/NGCP/Panel/Form/SubscriberEdit.pm b/lib/NGCP/Panel/Form/SubscriberEdit.pm index 87a5f7167e..040b8acb5c 100644 --- a/lib/NGCP/Panel/Form/SubscriberEdit.pm +++ b/lib/NGCP/Panel/Form/SubscriberEdit.pm @@ -188,6 +188,13 @@ sub update_fields { $c->uri_for_action('/subscriberprofile/profile_ajax', [$set_id])->as_string ); } + + if(!$c->user->show_passwords) { + $self->field('webpassword')->inactive(1); + $self->field('webpassword')->required(0); + $self->field('password')->inactive(1); + $self->field('password')->required(0); + } } sub validate_password { diff --git a/lib/NGCP/Panel/Role/API/Subscribers.pm b/lib/NGCP/Panel/Role/API/Subscribers.pm index cebe7a5433..5f676e59ab 100644 --- a/lib/NGCP/Panel/Role/API/Subscribers.pm +++ b/lib/NGCP/Panel/Role/API/Subscribers.pm @@ -148,6 +148,11 @@ sub resource_from_item { }else{ $resource{lock} = undef; } + unless ($c->user->show_passwords) { + foreach my $k(qw/password webpassword/) { + delete $resource{$k}; + } + } } else { if (!$self->subscriberadmin_write_access($c)) { # fields we never want to see