summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oetiker <tobi@oetiker.ch>2012-04-02 09:20:35 +0200
committerTobias Oetiker <tobi@oetiker.ch>2012-04-02 09:20:35 +0200
commit11838ebc2ae0661130544c383643046803d8d45b (patch)
tree9d2e57a975d2391a8da6d669f91caea3888344b7
parent8837a8d3a033a124644d6085555d70afa1372a30 (diff)
parent6fae074f1a8a305b0a8361626902110e7351a65b (diff)
downloadsmokeping-11838ebc2ae0661130544c383643046803d8d45b.tar.gz
smokeping-11838ebc2ae0661130544c383643046803d8d45b.tar.xz
Merge branch 'master' of github.com:oetiker/SmokePing
-rw-r--r--doc/smokeping_install.pod2
-rw-r--r--etc/basepage.html.dist1
-rw-r--r--lib/Smokeping.pm4
3 files changed, 7 insertions, 0 deletions
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<authuser> will be populated
+from the C<$ENV{REMOTE_USER}> environment variable.
=item F<etc/smokemail>
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 {
<TR>
<TD class="menubar" align="left" width="130" valign="top">
<P></P>
+ <P><h3>Logged in as <##authuser##></h3></P>
<P><B>SmokePing Targets:</B>&nbsp;&nbsp;</P>
<P><##menu##></P>
<br/>
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index ec05528..6bb07bc 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 => '<A HREF="http://oss.oetiker.ch/rrdtool/"><img border="0" src="'.$cfg->{General}{imgurl}.'/rrdtool.png"></a>',
smokelogo => '<A HREF="http://oss.oetiker.ch/smokeping/counter.cgi/'.$VERSION.'"><img border="0" src="'.$cfg->{General}{imgurl}.'/smokeping.png"></a>',
+ authuser => $authuser,
}
);
my $expi = $cfg->{Database}{step} > 120 ? $cfg->{Database}{step} : 120;
@@ -3955,6 +3957,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},
{
@@ -3973,6 +3976,7 @@ sub gen_page ($$$) {
step => $step,
rrdlogo => '<A HREF="http://oss.oetiker.ch/rrdtool/"><img border="0" src="'.$cfg->{General}{imgurl}.'/rrdtool.png"></a>',
smokelogo => '<A HREF="http://oss.oetiker.ch/smokeping/counter.cgi/'.$VERSION.'"><img border="0" src="'.$cfg->{General}{imgurl}.'/smokeping.png"></a>',
+ authuser => $authuser,
});
print PAGEFILE $page || "<HTML><BODY>ERROR: Reading page template ".$cfg->{Presentation}{template}."</BODY></HTML>";