package Com::Domain::Site::Login;
use strict;
use warnings;
use Org::Bgw::Pas::Page;
our @ISA = qw( Org::Bgw::Pas::Page );
Com::Domain::Site::Basket->installExecuteSwitch(
'param' => 'action',
'map' => {
'default' => 'showLoginForm',
'login' => 'handleUserLoggingIn',
'logout' => 'handleUserLoggingOut',
}
);
# that code would then create your execute method for you. The method looks like
# this:
# sub execute
# {
# my($self) = @_;
# unless( defined( $self->query->param('action') ) ) {
# return $self->showLoginForm;
# }
# return $self->handleUserLoggingIn if 'login' eq $self->query->param('action') ;
# return $self->handleUserLoggingOut if 'logout' eq $self->query->param('action') ;
# }
#
# 'action' could have been any parameter that your HTML pages pass to
# the page object to switch it's behavior (this is a commonly used technique
# when you want the page to act differently based on an input parameter).
# now you don't even need an execute method, these methods will just
# get called when the corresponding action is encountered!
sub showLoginForm
{
my($self) = @_;
return $self->forward_request('loginForm.psp');
}
sub handleUserLoggingIn
{
my($self) = @_;
# do whatever it means to log in on your site...
return $self->response->set_redirect('/pas/Main');
}
sub handleUserLoggingOut
{
my($self) = @_;
# do whatever it means to log out on your site...
return $self->forward_request('loggedOut.psp');
}
1;
--
------------------------------------------------------------------------------
Wisdom and Compassion are inseparable.
-- Christmas Humphreys
mo...@vo... http://www.voicenet.com/~mortis
------------------------------------------------------------------------------
|