Skip Menu |

This queue is for tickets about the CGI-Application-Plugin-Authentication CPAN distribution.

Report information
The Basics
Id: 35989
Status: resolved
Priority: 0/
Queue: CGI-Application-Plugin-Authentication

People
Owner: Nobody in particular
Requestors: CHORNY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] devpopup support
Outputs login, pass and username to devpopup window. I think that it is safe to output password as devpopup is only a development tool. Used this patch myself when developing a web application with authentication. Part of code was copied from CGI::Application::Plugin::DevPopup. -- Alexandr Ciornii, http://chorny.net
Subject: Authentication.pm.patch
--- Authentication.pm.dist Sun Oct 1 00:43:15 2006 +++ Authentication.pm Mon May 19 00:32:16 2008 @@ -26,6 +26,7 @@ } else { $callpkg->add_callback( prerun => \&prerun_callback ); } + } use Attribute::Handlers; @@ -538,6 +539,44 @@ =cut +sub _devpopup_report { + my $self1 = shift; + my @list; + my $self=$self1->authen; + if ($self->username) { + push @list,['username',$self->username]; + } + my $config = $self->_config; + my $field_names = $config->{CREDENTIALS} || [qw(authen_username authen_password)]; + my $query = $self->_cgiapp->query; + my @credentials = map { $query->param($_) } @$field_names; + if ($credentials[0]) { + push @list,['login',$credentials[0]]; + push @list,['pass',$credentials[1]]; + } + my $r=0; + my $text = join $/, map { + $r=1-$r; + qq(<tr class="@{[$r?'odd':'even']}"><td valign="top">$_->[0]</td><td>$_->[1]</td></tr>) + } + @list; + $self1->devpopup->add_report( + title => 'Authentication', + summary => '', + report => qq( + <style type="text/css"> + tr.even{background-color:#eee} + </style> + <div style="font-size: 80%"> + <table> + <thead><tr><th>Parameter</th><th>Value</th></tr></thead> + <tbody>$text</tbody> + </table> + </div> + ), + ); +} + sub config { my $self = shift; my $class = ref $self ? ref $self : $self; @@ -1155,6 +1194,10 @@ # but that causes an infinite loop. $self->{initialized} = 1; + if (UNIVERSAL::can($self->_cgiapp, 'devpopup')) { + $self->_cgiapp->add_callback( 'devpopup_report', \&_devpopup_report ); + } + my $config = $self->_config; # See if the user is trying to log in
Added in next release. Thanks for the patch