AxKit-App-TABOO
view release on metacpan or search on metacpan
lib/AxKit/App/TABOO.pm view on Meta::CPAN
package AxKit::App::TABOO;
our $VERSION = '0.52';
use 5.7.3;
use strict;
use warnings;
use Session;
use Apache;
use Apache::Cookie;
use Apache::Request;
use AxKit;
sub session_config {
my $r = shift;
my $prefix = $r->dir_config( 'TABOOPrefix') || 'TABOO';
my %session_config = (
Store => $r->dir_config( $prefix . 'DataStore' ) || 'DB_File',
Lock => $r->dir_config( $prefix . 'Lock' ) || 'Null',
Generate => $r->dir_config( $prefix . 'Generate' ) || 'MD5',
lib/AxKit/App/TABOO.pm view on Meta::CPAN
}
return %session_config;
}
sub session {
my $r = shift;
my $req = Apache::Request->instance($r);
my $vid = $req->param('VID');
unless ($vid) { # Then look in the cookie
my $cookies = Apache::Cookie->fetch;
my $tmp = $cookies->{'VID'};
return undef unless defined($tmp);
$vid = $tmp->value;
return undef unless ($vid); # No session key
}
AxKit::Debug(9, "User's visitor ID: $vid");
return new Session $vid, session_config($r);
}
lib/AxKit/App/TABOO/AddXSLParams/Session.pm view on Meta::CPAN
package AxKit::App::TABOO::AddXSLParams::Session;
use 5.6.0;
use strict;
use warnings;
use AxKit;
use AxKit::App::TABOO;
use Session;
use Apache::Constants;
use Apache::Cookie;
use Apache::Request;
use Apache::URI;
use AxKit::App::TABOO;
our $VERSION = '0.1';
sub handler {
my $r = shift;
my $uri = $r->uri;
my $cgi = Apache::Request->instance($r);
lib/AxKit/App/TABOO/Handler/Login.pm view on Meta::CPAN
package AxKit::App::TABOO::Handler::Login;
# This is a simple mod_perl Handler to implement session tracking,
# just for the purpose of login users in.
use Apache::Constants qw(:common);
use Apache;
use Apache::Request;
#use Apache::Cookie;
use Session;
use AxKit::App::TABOO::Data::User::Contributor;
use AxKit::App::TABOO;
use strict;
use warnings;
use Carp;
our $VERSION = '0.2';
sub handler {
my $r = shift;
my %session_config = AxKit::App::TABOO::session_config($r);
my $cookie = $r->header_in('Cookie');
if (defined($cookie) && $cookie =~ m/VID=(\w*)/) {
# so, the user is logged in allready. Kill that session, then
my $session = new Session $1, %session_config;
$session->delete if defined $session;
}
my $outtext = '<html><head>';
my $req = Apache::Request->instance($r);
my $user = AxKit::App::TABOO::Data::User::Contributor->new();
my $authlevel = $user->load_authlevel($req->param('username'));
if ($authlevel) { # So, the user exists
my $encrypted = $user->load_passwd($req->param('username'));
if ($req->param('clear') && $encrypted && (crypt($req->param('clear'),$encrypted) eq $encrypted)) {
my $redirect = $r->header_in("Referer") || '/';
my $session = new Session undef, %session_config;
$r->header_out("Set-Cookie" => 'VID='.$session->session_id());
$session->set(authlevel => $authlevel);
$session->set(loggedin => $req->param('username'));
$outtext .= '<meta http-equiv="refresh" content="1;url='.$redirect.'">';
$outtext .= '<title>Log in</title></head><body><h1>Logged in</h1><p>Password is valid, go to <a href="/">main page</a>.</p>';
} else {
$outtext .= '<title>Log in</title></head><body><h1>Log in</h1><p>Password is invalid, go back and try again!</p>';
}
} else {
$outtext .= '<title>Log in</title></head><body><h1>Log in</h1><p>Username was not found, go back and try again!</p>';
}
lib/AxKit/App/TABOO/XSP/User.pm view on Meta::CPAN
use 5.6.0;
use strict;
use warnings;
use Apache::AxKit::Language::XSP::SimpleTaglib;
use Apache::AxKit::Exception;
use AxKit;
use AxKit::App::TABOO;
use AxKit::App::TABOO::Data::User;
use AxKit::App::TABOO::Data::User::Contributor;
use Session;
use Apache::Cookie;
use Crypt::GeneratePassword;
use Data::Dumper;
use vars qw/$NS/;
our $VERSION = '0.4';
# Some constants
# TODO: This stuff should go somewhere else!
( run in 0.596 second using v1.01-cache-2.11-cpan-e9199f4ba4c )