From e37bdd8f03e0142e64f54c9ebdbb8147dd6ab8db Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Mon, 13 Jan 2025 17:17:28 +0100 Subject: [PATCH] user: show error if clearing auth cache fails --- lib/Thruk/Controller/user.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Thruk/Controller/user.pm b/lib/Thruk/Controller/user.pm index aa9dd3a1d..4ad2b3e09 100644 --- a/lib/Thruk/Controller/user.pm +++ b/lib/Thruk/Controller/user.pm @@ -158,7 +158,11 @@ sub user_page { if($c->req->parameters->{'clear_auth_cache'}) { $c->stash->{'profile_user'} = Thruk::Authentication::User->new($c, $c->stash->{'remote_user'})->set_dynamic_attributes($c); - Thruk::Utils::set_message( $c, 'success_message', 'Auth cache cleared successfully.' ); + if($c->stash->{'profile_user'} && $c->stash->{'profile_user'}->{'timestamp'} && time() - $c->stash->{'profile_user'}->{'timestamp'} < 5) { + Thruk::Utils::set_message( $c, 'success_message', 'Auth cache cleared successfully.' ); + } else { + Thruk::Utils::set_message( $c, 'fail_message', 'Failed to clear auth cache. Authoritive backends down?' ); + } return $c->redirect_to('user.cgi'); }