NAME Plack::App::Login::Request - Plack application for request of login information. SYNOPSIS use Plack::App::Login::Request; my $obj = Plack::App::Login::Request->new(%parameters); my $psgi_ar = $obj->call($env); my $app = $obj->to_app; METHODS "new" my $obj = Plack::App::Login::Request->new(%parameters); Constructor. * "author" Author string to HTML head. Default value is undef. * "content_type" Content type for output. Default value is 'text/html; charset=__ENCODING__'. * "css" Instance of CSS::Struct::Output object. Default value is CSS::Struct::Output::Raw instance. * "css_init" Reference to array with CSS::Struct structure. Default value is CSS initialization from Tags::HTML::Page::Begin like * { box-sizing: border-box; margin: 0; padding: 0; } * "encoding" Set encoding for output. Default value is 'utf-8'. * "favicon" Link to favicon. Default value is undef. * "flag_begin" Flag that means begin of html writing via Tags::HTML::Page::Begin. Default value is 1. * "flag_end" Flag that means end of html writing via Tags::HTML::Page::End. Default value is 1. * "generator" HTML generator string. Default value is 'Plack::App::Login; Version: __VERSION__'. * "login_link" Login link. Default value is 'login'. * "login_title" Login title. Default value is 'LOGIN'. * "psgi_app" PSGI application to run instead of normal process. Intent of this is change application in "_process_actions" method. Default value is undef. * "script_js" Reference to array with Javascript code strings. Default value is []. * "script_js_src" Reference to array with Javascript URLs. Default value is []. * "status_code" HTTP status code. Default value is 200. * "tags" Instance of Tags::Output object. Default value is Tags::Output::Raw->new( 'xml' => 1, 'no_simple' => ['script', 'textarea'], 'preserved' => ['pre', 'style'], ); * "title" Page title. Default value is 'Login page'. Returns instance of object. "call" my $psgi_ar = $obj->call($env); Implementation of login request page. Returns reference to array (PSGI structure). "to_app" my $app = $obj->to_app; Creates Plack application. Returns Plack::Component object. EXAMPLE use strict; use warnings; use CSS::Struct::Output::Indent; use Plack::App::Login::Request; use Data::Message::Simple; use Plack::Builder; use Plack::Runner; use Plack::Session; use Tags::Output::Indent; use Unicode::UTF8 qw(decode_utf8); my $message_cb = sub { my ($env, $message_type, $message) = @_; my $session = Plack::Session->new($env); my $m = Data::Message::Simple->new( 'text' => $message, 'type' => $message_type, ); my $messages_ar = $session->get('messages'); if (defined $messages_ar) { push @{$messages_ar}, $m; } else { $session->set('messages', [$m]); } return; }; # Run application. my $app = Plack::App::Login::Request->new( 'css' => CSS::Struct::Output::Indent->new, 'generator' => 'Plack::App::Login::Request', 'login_request_cb' => sub { my ($env, $email) = @_; if ($email eq 'skim@skim.cz') { return 1; } else { return 0; } }, 'message_cb' => $message_cb, 'redirect_login' => '/', 'redirect_error' => '/', 'tags' => Tags::Output::Indent->new( 'preserved' => ['style'], 'xml' => 1, ), )->to_app; my $builder = Plack::Builder->new; $builder->add_middleware('Session'); my $app_with_session = $builder->wrap($app); Plack::Runner->new->run($app_with_session); # Workflows: # 1) Blank request. # 2) Fill skim@skim.cz email and request. # 3) Fill another email and request. # Output: # HTTP::Server::PSGI: Accepting connections at http://0:5000/ # > curl http://localhost:5000/ # # # # # # # # Login request page # # # # #
#
#
#
# # Login request # #

#

#

# #

#
#
#
#
# # # Output screenshot is in images/ directory. DEPENDENCIES Plack::Component::Tags::HTM, Plack::Request, Plack::Response, Plack::Session, Plack::Util::Accessor, Tags::HTML::Container, Tags::HTML::Login::Request. SEE ALSO Plack::App::Login Plack login application. Plack::App::Login::Password Plack login/password application. Plack::App::Register Plack register application. REPOSITORY AUTHOR Michal Josef Špaček LICENSE AND COPYRIGHT © 2024 Michal Josef Špaček BSD 2-Clause License VERSION 0.02