CGI-Application-Plugin-Authentication
view release on metacpan or search on metacpan
t/03_login_box.t view on Meta::CPAN
#!/usr/bin/perl -T
use Test::More;
use Test::Taint;
use Test::Regression;
use English qw(-no_match_vars);
if ($OSNAME eq 'MSWin32') {
my $msg = 'Not running these tests on windows yet';
plan skip_all => $msg;
exit(0);
}
plan tests => 7;
use strict;
use warnings;
use CGI ();
taint_checking_ok('taint checking is on');
$ENV{CGI_APP_RETURN_ONLY} = 1;
my $cap_options =
{
DRIVER => [ 'Generic', { user1 => '123' } ],
STORE => ['Cookie', SECRET => "Shhh, don't tell anyone", NAME => 'CAPAUTH_DATA', EXPIRY => '+1y'],
POST_LOGIN_CALLBACK => \&TestAppAuthenticate::post_login,
};
{
package TestAppAuthenticate;
use base qw(CGI::Application);
use CGI::Application::Plugin::Authentication;
sub setup {
my $self = shift;
$self->start_mode('one');
$self->run_modes([qw(one two)]);
$self->authen->protected_runmodes(qw(two));
$self->authen->config($cap_options);
}
sub one {
my $self = shift;
}
sub two {
my $self = shift;
}
sub post_login {
my $self = shift;
my $count=$self->param('post_login')||0;
$self->param('post_login' => $count + 1 );
}
}
test_auth();
test_auth('cosmetic', {
TITLE=>'Aanmelden',
USERNAME_LABEL=>'Gebruikersnaam',
PASSWORD_LABEL=>'Wachtwoord',
SUBMIT_LABEL=>'Aanmelden',
COMMENT=>'Vul uw gebruikersnaam en wachtwoord in de velden hieronder.',
REMEMBERUSER_LABEL=>'Onthouden Gebruikersnaam',
INVALIDPASSWORD_MESSAGE=>'Ongeldige gebruikersnaam of wachtwoord <br /> (login poging% d)',
INCLUDE_STYLESHEET=>0
});
test_auth('red', {
BASE_COLOUR=>'#884454',
LIGHT_COLOUR=>'49%',
LIGHTER_COLOUR=>'74%',
DARK_COLOUR=>'29%',
DARKER_COLOUR=>'59%'
}, 1);
test_auth('green', {
BASE_COLOUR=>'#2cf816'
}, 1);
test_auth('grey_extra', {
BASE_COLOUR=>'#445588',
}, 1);
test_auth('grey_extra2', {
( run in 1.653 second using v1.01-cache-2.11-cpan-d7f47b0818f )