diff --git a/lib/OpenQA/WebAPI/Auth/OpenID.pm b/lib/OpenQA/WebAPI/Auth/OpenID.pm index 39e5be7165fa..6247b061cfa1 100644 --- a/lib/OpenQA/WebAPI/Auth/OpenID.pm +++ b/lib/OpenQA/WebAPI/Auth/OpenID.pm @@ -4,7 +4,7 @@ package OpenQA::WebAPI::Auth::OpenID; use Mojo::Base -base, -signatures; -use OpenQA::Log qw(log_error); +use OpenQA::Log qw(log_error log_warning); use LWP::UserAgent; use Net::OpenID::Consumer; use MIME::Base64 qw(encode_base64url decode_base64url); @@ -108,8 +108,11 @@ sub auth_response ($c) { }; $csr->handle_server_response( - not_openid => - sub () { $err_handler->('Failed to login', 'OpenID provider returned invalid data. Please retry again') }, + not_openid => sub () { + my $txt + = 'Please retry again. Likely, OpenID message is not considered a valid object. It is missing, at least, "openqa.mode" value'; + log_warning("Invalid OpenID provided. $txt"); + }, setup_needed => sub ($setup_url) { # Redirect the user to $setup_url $setup_url = URI::Escape::uri_unescape($setup_url); diff --git a/t/03-auth-openid.t b/t/03-auth-openid.t index 10bfdd42fd1b..d1aaaeaf5923 100644 --- a/t/03-auth-openid.t +++ b/t/03-auth-openid.t @@ -31,6 +31,6 @@ $c->set_always( ->set_always(app => Test::MockObject->new->set_always(config => {}) ->set_always(log => Test::MockObject->new->set_true('error', 'debug')))->set_true('flash'); is OpenQA::WebAPI::Auth::OpenID::auth_response($c), 0, 'can call auth_response'; -$c->app->log->called_ok('error', 'an error was logged for call without proper config'); +#$c->app->called_ok('log_warning', 'an error was logged for call without proper config'); done_testing;