There is no point asking already logged in users to log in again if they don't have enough privileges.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/CGI/PageBase.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/CGI/PageBase.pm b/testbot/lib/WineTestBot/CGI/PageBase.pm index 3a78a44d4..d68b97289 100644 --- a/testbot/lib/WineTestBot/CGI/PageBase.pm +++ b/testbot/lib/WineTestBot/CGI/PageBase.pm @@ -88,12 +88,15 @@ sub new($$$$@) { $self->CheckSecurePage(); my $Session = $self->GetCurrentSession(); - if (! defined($Session) || - ! $Session->User->HasRole($RequiredRole)) + if (!defined $Session) { my $LoginURL = "/Login.pl?Target=" . uri_escape($ENV{"REQUEST_URI"}); exit($self->Redirect(MakeSecureURL($LoginURL))); } + elsif (!$Session->User->HasRole($RequiredRole)) + { + exit($self->Redirect("/")); + } }
$self->_initialize(@_);