CGI-Application-Plugin-Authentication

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/out/grey_extra2
t/out/login
t/out/login-dev
t/out/loginurl
t/out/logout
t/out/missing_color
t/out/names_of_colours
t/out/names_of_colours_2
t/out/names_of_colours_3
t/out/other_permutations
t/out/percentage
t/out/red
t/out/redirect
t/out/redirection_failure
t/out/redirection_failure_basic
t/out/restricted
t/out/runmode
t/out/success
t/out/success-dev
t/out/username
t/out/username-basic

README  view on Meta::CPAN

            use this to automatically focus the login form when the page
            loads so a user can start typing right away.

        BASE_COLOUR (default: #445588)
            This is the base colour that will be used in the included login
            box. All other colours are automatically calculated based on
            this colour (unless you hardcode the colour values). In order to
            calculate other colours, you will need the Color::Calc module.
            If you do not have the Color::Calc module, then you will need to
            use fixed values for all of the colour options. All colour
            values besides the BASE_COLOUR can be simple percentage values
            (including the % sign). For example if you set the
            LIGHTER_COLOUR option to 80%, then the calculated colour will be
            80% lighter than the BASE_COLOUR.

        LIGHT_COLOUR (default: 50% or #a2aac4)
            A colour that is lighter than the base colour.

        LIGHTER_COLOUR (default: 75% or #d0d5e1)
            A colour that is another step lighter than the light colour.

lib/CGI/Application/Plugin/Authentication.pm  view on Meta::CPAN


use this to automatically focus the login form when the page loads so a user can start typing right away.

=item BASE_COLOUR (default: #445588)

This is the base colour that will be used in the included login box.  All other
colours are automatically calculated based on this colour (unless you hardcode
the colour values).  In order to calculate other colours, you will need the
Color::Calc module.  If you do not have the Color::Calc module, then you will
need to use fixed values for all of the colour options.  All colour values
besides the BASE_COLOUR can be simple percentage values (including the % sign).
For example if you set the LIGHTER_COLOUR option to 80%, then the calculated
colour will be 80% lighter than the BASE_COLOUR.

=item LIGHT_COLOUR (default: 50% or #a2aac4)

A colour that is lighter than the base colour.

=item LIGHTER_COLOUR (default: 75% or #d0d5e1)

A colour that is another step lighter than the light colour.

lib/CGI/Application/Plugin/Authentication/Display/Classic.pm  view on Meta::CPAN

    $colour{lighter} = $login_form->{LIGHTER_COLOUR} if $login_form->{LIGHTER_COLOUR};
    $colour{light}   = $login_form->{LIGHT_COLOUR} if $login_form->{LIGHT_COLOUR};
    $colour{dark}    = $login_form->{DARK_COLOUR} if $login_form->{DARK_COLOUR};
    $colour{darker}  = $login_form->{DARKER_COLOUR} if $login_form->{DARKER_COLOUR};
    $colour{grey}    = $login_form->{GREY_COLOUR} if $login_form->{GREY_COLOUR};
    
    my @undefined_colours =  grep { ! defined $colour{$_} || index($colour{$_}, '%') >= 0 } qw(lighter light dark darker);
    if (@undefined_colours) {
        eval { require Color::Calc };
        if ($@ && $login_form->{BASE_COLOUR}) {
            warn "Color::Calc is required when specifying a custom BASE_COLOUR, and leaving LIGHTER_COLOUR, LIGHT_COLOUR, DARK_COLOUR or DARKER_COLOUR blank or when providing percentage based colour";
        }
        if ($@) {
            $colour{base}    = '#445588';
            $colour{lighter} = '#d0d5e1';
            $colour{light}   = '#a2aac4';
            $colour{dark}    = '#303c5f';
            $colour{darker}  = '#1b2236';
            $colour{grey}    = '#565656';
        } else {
            $colour{lighter} = !$colour{lighter}

lib/CGI/Application/Plugin/Authentication/Display/Classic.pm  view on Meta::CPAN


use this to automatically focus the login form when the page loads so a user can start typing right away.

=item BASE_COLOUR (default: #445588)

This is the base colour that will be used in the included login box.  All other
colours are automatically calculated based on this colour (unless you hardcode
the colour values).  In order to calculate other colours, you will need the
Color::Calc module.  If you do not have the Color::Calc module, then you will
need to use fixed values for all of the colour options.  All colour values
besides the BASE_COLOUR can be simple percentage values (including the % sign).
For example if you set the LIGHTER_COLOUR option to 80%, then the calculated
colour will be 80% lighter than the BASE_COLOUR.

=item LIGHT_COLOUR (default: 50% or #a2aac4)

A colour that is lighter than the base colour.

=item LIGHTER_COLOUR (default: 75% or #d0d5e1)

A colour that is another step lighter than the light colour.

t/03_login_box_other.t  view on Meta::CPAN


subtest 'Percentage' => sub {
        plan tests => 1;
        local $cap_options->{LOGIN_FORM}->{LIGHT_COLOUR} = '20%';
        local $cap_options->{LOGIN_FORM}->{LIGHTER_COLOUR} = '10%';
        local $cap_options->{LOGIN_FORM}->{DARK_COLOUR} = '80%';
        local $cap_options->{LOGIN_FORM}->{DARKER_COLOUR} = '90%';
        my $query = CGI->new( { rm => 'two'} );

        my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
        ok_regression(sub {make_output_timeless($cgiapp->run)}, "t/out/percentage", "Percentage");

};

subtest 'Names of colours' => sub {
        plan tests => 1;
        local $cap_options->{LOGIN_FORM}->{LIGHT_COLOUR} = '110%';
        local $cap_options->{LOGIN_FORM}->{LIGHTER_COLOUR} = 'red';
        local $cap_options->{LOGIN_FORM}->{DARK_COLOUR} = 'green';
        local $cap_options->{LOGIN_FORM}->{DARKER_COLOUR} = 'blue';
        my $query = CGI->new( { rm => 'two'} );

t/03_missing_color.t  view on Meta::CPAN



subtest 'Base color' => sub {
        plan tests => 2;
        local $cap_options->{LOGIN_FORM}->{BASE_COLOUR} = 'purple';
        my $query = CGI->new( { rm => 'two'} );

        my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
        my $output;
        warning_is {$output = $cgiapp->run;}
            "Color::Calc is required when specifying a custom BASE_COLOUR, and leaving LIGHTER_COLOUR, LIGHT_COLOUR, DARK_COLOUR or DARKER_COLOUR blank or when providing percentage based colour",
            "checking generated warning";
        ok_regression(sub {make_output_timeless($output)}, "t/out/missing_color", "Missing color");

};


subtest 'No Base color' => sub {
        plan tests => 1;
        my $query = CGI->new( { rm => 'two'} );



( run in 0.511 second using v1.01-cache-2.11-cpan-709fd43a63f )