From: Thomas Lamprecht Date: Thu, 27 Jun 2019 20:04:33 +0000 (+0200) Subject: login TFA exception: also print username and use raise X-Git-Url: https://git.proxmox.com/?p=pve-apiclient.git;a=commitdiff_plain;h=8bc98506cbcb3ee30f026cb91b5d584291ca9152 login TFA exception: also print username and use raise Signed-off-by: Thomas Lamprecht --- diff --git a/PVE/APIClient/LWP.pm b/PVE/APIClient/LWP.pm index 492f64d..c0e30ff 100755 --- a/PVE/APIClient/LWP.pm +++ b/PVE/APIClient/LWP.pm @@ -102,12 +102,13 @@ sub login { $uri->path('/api2/json/access/ticket'); my $ua = $self->{useragent}; + my $username = $self->{username} // 'unknown', delete $self->{last_unknown_fingerprint}; my $exec_login = sub { return $ua->post($uri, { - username => $self->{username} || 'unknown', + username => $username, password => $self->{password} || ''}); }; @@ -131,7 +132,7 @@ sub login { # TODO: make it possible to use tfa if ($data->{ticket} =~ m/^PVE:tfa!/) { - die "TFA in API is not yet implemented! Try disabling TFA for the user.\n"; + raise("Two Factor Auth is not yet implemented! Try disabling TFA for the user '$username'.\n"); } $self->update_ticket($data->{ticket});