<%doc>
############################################################################
###    (C)opyright 2003 - 2008 RIPE NCC
###    This file is part of DNSMon
###
###    DNSMon is free software: you can redistribute it and/or modify
###    it under the terms of the GNU General Public License as published by
###    the Free Software Foundation, either version 3 of the License, or
###    (at your option) any later version.
###
###    DNSMon is distributed in the hope that it will be useful,
###    but WITHOUT ANY WARRANTY; without even the implied warranty of
###    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
###    GNU General Public License for more details.
###
###    You should have received a copy of the GNU General Public License
###    along with DNSMon.  If not, see <http://www.gnu.org/licenses/>.
############################################################################
</%doc>
<%args>
	$group => undef
	$user => undef
	$password => undef
	$error=> undef
</%args>
% if (not $TICKET) { 
% 	if ($error) {
	<p class="error">Error:
		<ul>
			<li class="error"><% $error %></li>
		</ul>
	</p>
% 	}

<form name="login" id="login" method="post" action="<% $actionLogin %>">
	<div class="center">
		<input type="hidden" name="conf" value="<% $CONFIG{conf} | h %>" />
% if (exists ($r->headers_in->{Referer}) && $r->headers_in->{Referer} ) {
		<input type="hidden" name="forward_success" value="<% $r->headers_in->{Referer} %>" />
% } else {
		<input type="hidden" name="forward_success" value="<& /lib/url, host => $r->hostname, port => $r->get_server_port, path => '/dns-servmon/index.html' &>" />
% }
		<input type="hidden" name="forward_fail" value="<& /lib/url, host => $r->hostname, port => $r->get_server_port, path => '/dns-servmon/auth/login' &>" />

		<table class="center" summary="Enter loginname and password ">
			<tr>
				<td>Username:</td>
				<td><input tabindex="21" type="text" name="user" value="<% $user | h %>" /></td>
			</tr>

			<tr>
				<td>Password:</td>
				<td><input tabindex="22" type="password" name="password" /></td>
			</tr>

			<tr>
				<td colspan="2"><input tabindex="23" type="submit" value="Login" /></td>
			</tr>

		</table>
		<a href="<& /lib/url, path => 'contact.html' &>">Forgot your password?</a><br />
		<a href="<& /lib/url, path => 'contact.html' &>">Subscribe</a>
	</div>
</form>
% } else {
<p>
	Logged in as <b><% $TICKET->logname() =~ /^\.(.*)$/ %></b> since <% strftime("%a %e %B %Y %T %Z",localtime($TICKET->lastAccessTime())) %>
</p>
% }
<%init>
	my $uri = URI->new($CONFIG{login_url});
	my $actionLogin = $m->scomp('/lib/url',
		scheme => $uri->scheme,
		host => $uri->host,
		port => $uri->port,
		path => $uri->path,
	  );
</%init>
