Permalink
Browse files

using _wrap_body from P:M:A:Form

  • Loading branch information...
1 parent d1d87b0 commit c30e9b96ab1c3fd7db704f3491f2ce8e1d706242 Zbigniew Lukasiak committed Nov 1, 2011
Showing with 19 additions and 3 deletions.
  1. +3 −3 lib/Nblog.pm
  2. +16 −0 lib/Nblog/LoginPage.pm
View
@@ -16,7 +16,6 @@ use Plack::Session::Store::Cache;
use Plack::App::Cascade;
use Plack::App::URLMap;
use Plack::App::File;
-use Plack::Middleware::Auth::Form;
use CHI;
@@ -28,6 +27,7 @@ use File::ShareDir ();
use Cwd qw[abs_path];
use File::Spec ();
+use Nblog::LoginPage;
with 'MooseX::SimpleConfig';
@@ -226,7 +226,7 @@ around psgi_app => sub {
$app->map( '/static', $cascade );
$app->map( '/favicon.ico', $favicon_c );
$app->map( '/', $self->$orig( @_ ) );
- $app = Plack::Middleware::Auth::Form->wrap(
+ $app = Nblog::LoginPage->wrap(
$app->to_app,
authenticator => sub {
my( $username, $password ) = @_;
@@ -236,8 +236,8 @@ around psgi_app => sub {
}
return 0;
},
- no_login_page => 1,
secure => $self->secure,
+ renderer => $self->renderer,
);
return Plack::Middleware::Session->wrap(
$app,
View
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+package Nblog::LoginPage;
+
+use parent 'Plack::Middleware::Auth::Form';
+
+use Plack::Util::Accessor qw( renderer );
+
+sub _wrap_body {
+ my ($self, $content) = @_;
+ return $self->renderer->render( template => \$content );
+}
+
+1;
+

0 comments on commit c30e9b9

Please sign in to comment.