From 50333cf052a6fc2ed29f16639ac1d0c891978b38 Mon Sep 17 00:00:00 2001 From: Darren Murphy Date: Mon, 6 Feb 2012 20:25:06 +0800 Subject: Add template support for http auth user --- lib/Smokeping.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index bba6dca..b15880b 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -1677,6 +1677,7 @@ sub display_webpage($$){ my $display_tree = $tree->{__tree_link} ? $tree->{__tree_link} : $tree; + my $authuser = $ENV{REMOTE_USER} || 'Guest'; my $page = fill_template ($cfg->{Presentation}{template}, { @@ -1700,6 +1701,7 @@ sub display_webpage($$){ step => $step, rrdlogo => '', smokelogo => '', + authuser => $authuser, } ); my $expi = $cfg->{Database}{step} > 120 ? $cfg->{Database}{step} : 120; @@ -3945,6 +3947,7 @@ sub gen_page ($$$) { my $step = $probes->{$tree->{probe}}->step(); my $readversion = "?"; $VERSION =~ /(\d+)\.(\d{3})(\d{3})/ and $readversion = sprintf("%d.%d.%d",$1,$2,$3); + my $authuser = $ENV{REMOTE_USER} || 'Guest'; $page = fill_template ($cfg->{Presentation}{template}, { @@ -3963,6 +3966,7 @@ sub gen_page ($$$) { step => $step, rrdlogo => '', smokelogo => '', + authuser => $authuser, }); print PAGEFILE $page || "ERROR: Reading page template ".$cfg->{Presentation}{template}.""; -- cgit v1.2.3-24-g4f1b From 8e9692b5f8a39eea12521f7ae9ad9b62c28ae6f5 Mon Sep 17 00:00:00 2001 From: Darren Murphy Date: Fri, 23 Mar 2012 13:10:55 +0800 Subject: Template support for HTTP auth user * Updated doc * Added section to basepage.html.dist --- doc/smokeping_install.pod | 2 ++ etc/basepage.html.dist | 1 + 2 files changed, 3 insertions(+) diff --git a/doc/smokeping_install.pod b/doc/smokeping_install.pod index f3b81bd..0c922d9 100644 --- a/doc/smokeping_install.pod +++ b/doc/smokeping_install.pod @@ -175,6 +175,8 @@ Edit the html template to your likings. Please do not remove the link to the SmokePing counter and my name from the template. The content of the template will be renderd by smokeping.cgi. This means that all embedded links must be relative to smokeping.cgi. +If you are using HTTP authentication, then the template variable C will be populated +from the C<$ENV{REMOTE_USER}> environment variable. =item F diff --git a/etc/basepage.html.dist b/etc/basepage.html.dist index ff347c1..fbf0d55 100644 --- a/etc/basepage.html.dist +++ b/etc/basepage.html.dist @@ -66,6 +66,7 @@ a.menulink:hover {

+

Logged in as <##authuser##>

SmokePing Targets:  

<##menu##>


-- cgit v1.2.3-24-g4f1b