« blib/lib/Lemonldap/NG/Portal/Lib/Captcha.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/Plugins/AuthOidcPkce.pm »
| 1 | package Lemonldap::NG::Portal::Plugins::PublicPages; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Mouse; | ||
| 5 | |||
| 6 | extends 'Lemonldap::NG::Portal::Main::Plugin'; | ||
| 7 | |||
| 8 | our $VERSION = '2.0.10'; | ||
| 9 | |||
| 10 | sub init { | ||
| 11 | my ($self) = @_; | ||
| 12 | $self->addAuthRoute( public => { ':tpl' => 'run' }, ['GET'] ) | ||
| 13 | ->addUnauthRoute( public => { ':tpl' => 'run' }, ['GET'] ); | ||
| 14 | |||
| 15 | return 1; | ||
| 16 | } | ||
| 17 | |||
| 18 | sub run { | ||
| 19 | my ( $self, $req ) = @_; | ||
| 20 | my $tpl = $req->param('tpl'); | ||
| 21 | |||
| 22 | unless ( $tpl =~ /^[\w\.\-]+$/ ) { | ||
| 23 | $self->userLogger->error("Bad public path $tpl"); | ||
| 24 | return $self->p->sendError( $req, 'File not found', 404 ); | ||
| 25 | } | ||
| 26 | |||
| 27 | $tpl = "public/$tpl"; | ||
| 28 | my $path = | ||
| 29 | $self->conf->{templateDir} . '/' | ||
| 30 | . $self->conf->{portalSkin} | ||
| 31 | . "/$tpl.tpl"; | ||
| 32 | |||
| 33 | unless ( -e $path ) { | ||
| 34 | $self->userLogger->warn("File not found: $path"); | ||
| 35 | return $self->p->sendError( $req, 'File not found', 404 ); | ||
| 36 | } | ||
| 37 | return $self->p->sendHtml( $req, $tpl ); | ||
| 38 | } | ||
| 39 | |||
| 40 | 1; | ||
| 41 | |||
| 42 | __END__ | ||
| 43 | |||
| 44 | =pod | ||
| 45 | |||
| 46 | =encoding utf8 | ||
| 47 | |||
| 48 | =head1 NAME | ||
| 49 | |||
| 50 | Lemonldap::NG::Portal::Plugins::PublicPages - LLNG portal plugin that allows | ||
| 51 | one to publish HTML pages using LLNG framework | ||
| 52 | system. | ||
| 53 | |||
| 54 | =head1 SYNOPSIS | ||
| 55 | |||
| 56 | =over | ||
| 57 | |||
| 58 | =item Add "C<customPlugins = ::Plugins::PublicPages>" in your lemonldap-ng.ini | ||
| 59 | file | ||
| 60 | |||
| 61 | =item Create a "public" subdir in your template directory | ||
| 62 | |||
| 63 | =item Create your .tpl files inside | ||
| 64 | |||
| 65 | =item To access them, use "http://auth.your.domain/public/name" where "name" is | ||
| 66 | the template name | ||
| 67 | |||
| 68 | =back | ||
| 69 | |||
| 70 | =head1 DESCRIPTION | ||
| 71 | |||
| 72 | Lemonldap::NG::Portal::Plugins::PublicPages is a simple LLNG portal plugin that | ||
| 73 | allows one to publish HTML pages using LLNG portal framework. See SYNOPSIS for | ||
| 74 | more. | ||
| 75 | |||
| 76 | =head1 SEE ALSO | ||
| 77 | |||
| 78 | Most of the documentation is available on the website | ||
| 79 | L<http://lemonldap-ng.org> | ||
| 80 | |||
| 81 | =head2 OTHER POD FILES | ||
| 82 | |||
| 83 | =over | ||
| 84 | |||
| 85 | =item Writing an authentication module: L<Lemonldap::NG::Portal::Auth> | ||
| 86 | |||
| 87 | =item Writing a UserDB module: L<Lemonldap::NG::Portal::UserDB> | ||
| 88 | |||
| 89 | =item Writing a second factor module: L<Lemonldap::NG::Portal::Main::SecondFactor> | ||
| 90 | |||
| 91 | =item Writing an issuer module: L<Lemonldap::NG::Portal::Main::Issuer> | ||
| 92 | |||
| 93 | =item Writing another plugin: L<Lemonldap::NG::Portal::Main::Plugin> | ||
| 94 | |||
| 95 | =item Request object: L<Lemonldap::NG::Portal::Main::Request> | ||
| 96 | |||
| 97 | =item Adding parameters in the manager: L<Lemonldap::NG::Manager::Build> | ||
| 98 | |||
| 99 | =back | ||
| 100 | |||
| 101 | =head1 AUTHORS | ||
| 102 | |||
| 103 | =over | ||
| 104 | |||
| 105 | =item LemonLDAP::NG team L<http://lemonldap-ng.org/team> | ||
| 106 | |||
| 107 | =back | ||
| 108 | |||
| 109 | =head1 BUG REPORT | ||
| 110 | |||
| 111 | Use OW2 system to report bug or ask for features: | ||
| 112 | L<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues> | ||
| 113 | |||
| 114 | =head1 DOWNLOAD | ||
| 115 | |||
| 116 | Lemonldap::NG is available at | ||
| 117 | L<https://lemonldap-ng.org/download> | ||
| 118 | |||
| 119 | =head1 COPYRIGHT AND LICENSE | ||
| 120 | |||
| 121 | See COPYING file for details. | ||
| 122 | |||
| 123 | This library is free software; you can redistribute it and/or modify | ||
| 124 | it under the terms of the GNU General Public License as published by | ||
| 125 | the Free Software Foundation; either version 2, or (at your option) | ||
| 126 | any later version. | ||
| 127 | |||
| 128 | This program is distributed in the hope that it will be useful, | ||
| 129 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 130 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 131 | GNU General Public License for more details. | ||
| 132 | |||
| 133 | You should have received a copy of the GNU General Public License | ||
| 134 | along with this program. If not, see L<http://www.gnu.org/licenses/>. | ||
| 135 | |||
| 136 | =cut |