From 752d81de48f432a315cd53962c49dfca63b8d5a8 Mon Sep 17 00:00:00 2001 From: Oleksandr Duts Date: Thu, 7 Apr 2022 19:14:18 +0300 Subject: [PATCH] TT#146103 API POST resetpassword - subscriber search fix * If user@domain is provided then looking for the specified domain, otherwise - url domain. Change-Id: I8ad9e0dab0f83eb8200d80e8ad993fba7c16abd3 --- lib/NGCP/Panel/Controller/API/PasswordReset.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Controller/API/PasswordReset.pm b/lib/NGCP/Panel/Controller/API/PasswordReset.pm index 6aadddee69..a147ae152d 100644 --- a/lib/NGCP/Panel/Controller/API/PasswordReset.pm +++ b/lib/NGCP/Panel/Controller/API/PasswordReset.pm @@ -78,6 +78,11 @@ sub POST :Allow { } elsif($resource->{type} eq 'subscriber') { my ($user, $domain) = ($resource->{username}, $resource->{domain}); + + if ($user =~ /^([^\@]+)\@([^\@]+)/) { + ($user, $domain) = ($1, $2); + } + my $subscriber = $c->model('DB')->resultset('voip_subscribers')->find({ username => $user, 'domain.domain' => $domain, @@ -96,12 +101,12 @@ sub POST :Allow { uuid => $uuid_string, timestamp => NGCP::Panel::Utils::DateTime::current_local->epoch + 300, #expire in 5 minutes }); - + my $url = NGCP::Panel::Utils::Email::rewrite_url( $c->config->{contact}->{external_base_url}, $c->uri_for_action('/subscriber/recover_webpassword')->as_string); $url .= '?uuid=' . $uuid_string; - + NGCP::Panel::Utils::Email::password_reset($c, $subscriber, $url); } }