<%doc>
# 
# $Id: autohandler,v 1.3 2002/01/27 21:47:50 fpmip Exp $
#
# autohandler checks the session information to check whether the user
# has an ongoing session before giving access to the requested page.
# If the user was not authenticated, he will be checked using the
# ../internal/login.ipfc page

# Author : Tycho Fruru <tycho@fruru.com>

# Copyright (C) 2001,2002 Tycho Fruru <tycho@fruru.com>
# Copyright (C) 2001,2002 Conostix S.A. Luxembourg - Tycho Fruru <tycho@conostix.com>

# This program 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 2 of the License, or (at your
# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program 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.
#
</%doc>

<%perl>
my $session = $m->comp('../internal/session.ipfc')
  or die "Couldn't get a session context";
if ($session->{'authenticated'} == 0) {
	$m->comp('../internal/login.ipfc',session => $session);
} 
if ($session->{'authenticated'} == 1) {
	$m->call_next(session => $session);
} else {
</%perl>
<pre>
Cannot authenticate your session.  You probably don't exist.
</pre>
<%perl>
}
</%perl>
