%args> $userName => "" $password => "" %args> <%once> use HTML::Entities; # For encode_entities() use Masterkey::Admin; %once> <%perl> my $admin = new Masterkey::Admin(undef); my $tab = $admin->siteConf("redirectToTab"); if (defined $tab) { # For installations that default to a favoured tab. $m->comp("/mc/redirect.html", url => "$tab/"); } elsif ($userName eq "" || $password eq "") { # For sites requiring an initial login $m->comp("form", admin => $admin, userName => $userName, password => $password); } else { for (my $i = 1;; $i++) { my $ws = $admin->siteConf("login.$i.authRealm") or last; my $torus = new Masterkey::Admin::Torus($admin, $ws); my $rs = $torus->records(undef, { userName => $userName, password => $password }); my $users = $rs->records(); if (@$users) { my $tab = $admin->siteConf("login.$i.authRedirect"); return $m->comp("postLogin", tab => $tab, userName => $userName, password => $password, dest => "/"); } } $m->comp("form", admin => $admin, userName => $userName, password => $password, error => "No match"); } %perl> <%def form> <%args> $admin $userName $password $error => "" %args> <%perl> my $title = $admin->siteConf("frontPageTitle"); my $h1 = $admin->siteConf("frontPageH1") || $title; my $logo = $admin->siteConf("logo"); my $icon = $admin->siteConf("siteIcon"); %perl>
<% encode_entities($error) %>
% }
Masterkey::Admin version <% $Masterkey::Admin::VERSION %>
Running on <% `hostname` %>