diff --git a/lib/NGCP/Panel/Utils/Security.pm b/lib/NGCP/Panel/Utils/Security.pm index db1765f99a..cced2ebb76 100644 --- a/lib/NGCP/Panel/Utils/Security.pm +++ b/lib/NGCP/Panel/Utils/Security.pm @@ -80,7 +80,16 @@ EOF } my $config_failed_auth_attempts = $c->config->{security}->{failed_auth_attempts} // 3; #in case we requested to filter by username, we will use it as the only possible key - for my $key ( ( defined $params{id} && exists $usr->{$params{id}}) ? ( $params{id} ) : (keys %{ $usr }) ) { + my @user_ids; + if (defined $params{id}) { + if (exists $usr->{$params{id}}) { + @user_ids = ($params{id}); + } + } + else { + @user_ids = (keys %{ $usr }); + } + for my $key (@user_ids) { my $last_auth = $usr->{$key}->{last_auth} ? NGCP::Panel::Utils::DateTime::epoch_local($usr->{$key}->{last_auth}) : undef; if ($last_auth) { $last_auth->set_time_zone($c->session->{user_tz}) if $c->session->{user_tz};