Apache-PageKit
view release on metacpan or search on metacpan
docsrc/features.xml view on Meta::CPAN
</para>
<para>
PageKit access to pages based on the <literal><link linkend="config.page.require_login">require_login</link></literal> attribute.
If <literal><link linkend="config.page.require_login">require_login</link></literal>
is set to <emphasis>recent</emphasis>, then PageKit requires that session is currently active in the last
<literal><link linkend="config.global.recent_login_timeout">recent_login_timeout</link></literal>
seconds.
</para>
<para>
Note, that the pages <literal><link linkend="config.global.default_page">default_page</link></literal>,
<literal><link linkend="config.global.verify_page">verify_page</link></literal> and
<literal><link linkend="config.global.login_page">login_page</link></literal> can not be protected in any way.
</para>
</sect1>
<sect1><?dbhtml filename="validation.html"?>
<title>Form Validation</title>
<para>
PageKit uses <ulink url="http://search.cpan.org/doc/MARKSTOS/Data-FormValidator-1.5/lib/Data/FormValidator.pm">Data::FormValidator</ulink> to provide easy form validation. Highlights
fields in red that user filled incorrectly by using the
<link linkend="pkit.errorfont">PKIT_ERRORFONT</link> tag. In addition,
error message(s) are displayed using the <link linkend="pkit.messages">PKIT_MESSAGES</link> tag.
docsrc/reference.xml view on Meta::CPAN
Set this option to <emphasis>no</emphasis> to be compatible to PageKit < 1.09.
Defaults to <emphasis>yes</emphasis>.
</para>
</listitem>
</varlistentry>
<varlistentry id="config.global.recent_login_timeout">
<term>recent_login_timeout</term>
<listitem>
<para>
Seconds that user's session has to be inactive before a user is asked
to verify a password on pages with the <literal><link linkend="config.page.require_login">require_login</link></literal> attribute
set to <emphasis>recent</emphasis>. Defaults to 3600 (1 hour).
</para>
</listitem>
</varlistentry>
<varlistentry id="config.global.relaxed_parser">
<term>relaxed_parser</term>
<listitem>
<para>
If set to yes, this option allows template tags to be placed inside
HTML comments. It also permits spaces and newlines within the tag itself.
docsrc/reference.xml view on Meta::CPAN
<para>
Defaults to <emphasis>no</emphasis>.
See also <link linkend="model.api.pkit_gettext">pkit_gettext</link> and
<link linkend="model.api.pkit_gettext_message">pkit_gettext_message</link>
in the Model API.
</para>
</listitem>
</varlistentry>
<varlistentry id="config.global.verify_page">
<term>verify_page</term>
<listitem>
<para>
Verify password form. Defaults to <literal><link linkend="config.global.login_page">login_page</link></literal>.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2>
eg/Config/PageKit_Config-0.97.dtd view on Meta::CPAN
default_page CDATA "index"
login_page CDATA "login"
not_found_page CDATA #IMPLIED
model_base_class CDATA "MyPageKit::Common"
model_dispatch_prefix CDATA "MyPageKit::MyModel"
post_max CDATA "100000000"
recent_login_timeout CDATA "3600"
request_param_in_tmpl CDATA "no"
session_expires CDATA #IMPLIED
uri_prefix CDATA #IMPLIED
verify_page CDATA #IMPLIED>
<!ELEMENT SERVERS (SERVER)*>
<!ELEMENT SERVER EMPTY>
<!ATTLIST SERVER
id CDATA "Default"
can_edit (yes|no) "no"
cookie_domain NMTOKENS #IMPLIED
files_match CDATA #IMPLIED
html_clean_level (0|1|2|3|4|5|6|7|8|9) "9"
reload (yes|no) "no">
<!ELEMENT PAGES (PAGE)*>
eg/Model/MyPageKit/Common.pm view on Meta::CPAN
my $dbh = $model->dbh;
my $user_id = $ses_key->{user_id} or return;
my $sql_str = "SELECT login, passwd FROM pkit_user WHERE user_id=?";
my ($login, $epasswd) = $dbh->selectrow_array($sql_str,{},$user_id);
return unless $login;
# create a new hash and verify that it matches the supplied hash
# (prevents tampering with the cookie)
no strict 'refs';
my $newhash = Digest::MD5::md5_hex(join ':', ${ __PACKAGE__ . '::secret_md5' }, $user_id, crypt($epasswd,"pk"));
use strict 'refs';
return unless $newhash eq $ses_key->{'hash'};
$model->output(pkit_user => $user_id);
$model->output('pkit_login',$login);
eg/View/Default/newacct1.tmpl view on Meta::CPAN
<form method="post" action="newacct2">
<PKIT_ERRORSPAN NAME="email">Email:</PKIT_ERRORSPAN><br>
<input type="text" name="email">
<p>
<PKIT_ERRORSPAN NAME="login">Login:</PKIT_ERRORSPAN><br>
<input type="text" name="login">
<p>
<PKIT_ERRORSPAN NAME="passwd1">Password:</PKIT_ERRORSPAN><br>
<input type="password" name="passwd1">
<p>
<PKIT_ERRORSPAN NAME="passwd2">Password (verify):</PKIT_ERRORSPAN><br>
<input type="password" name="passwd2">
<input type="hidden" name="pkit_done" value="http://<PKIT_HOSTNAME>/">
<p>
<input type="submit" name="submit" value="Submit">
</form>
<PKIT_COMPONENT NAME="/bottom">
lib/Apache/PageKit.pm view on Meta::CPAN
if(defined($pkit_check_cookie) && $pkit_check_cookie eq 'on'){
$model->pkit_gettext_message('You have successfully logged in.');
}
$pk->update_session($auth_session_id);
my $require_login = $config->get_page_attr($pk->{page_id},'require_login');
if(defined($require_login) && $require_login eq 'recent'){
if(exists($session->{pkit_inactivity_timeout})){
# user is logged in, but has had inactivity period
# display verify password form
$pk->{page_id} = $config->get_global_attr('verify_page') || $config->get_global_attr('login_page');
$pk->{browser_cache} = 'no';
# pkit_done parameter is used to return user to page that they originally requested
# after login is finished
$output_param_object->param("pkit_done",$uri_with_query) unless $apr->param("pkit_done");
# $apr->connection->user(undef);
}
}
}
lib/Apache/PageKit/Config.pm view on Meta::CPAN
for my $tag ( keys %subs ) {
for my $node ( $root->findnodes("/CONFIG/$tag") ) {
$subs{$tag}($node);
}
}
# allow login at least on these pages
for my $page_id ( grep { $_ } ( $config->get_global_attr('default_page') || 'index',
$config->get_global_attr('login_page'),
$config->get_global_attr('verify_page'))) {
$page_attr->{$config_dir}->{$page_id}->{require_login} = 'no';
}
# remove leading or trailing /'s (if any)
for ( $global_attr->{$config_dir}->{'uri_prefix'} ) {
next unless $_;
s!/+$!!;
s!^/+!!;
}
}
t/02_language.t view on Meta::CPAN
# check if a unknown language is asked, then default_lang is used ( 'en' ) in our case. But 'xy' is seen by modelcode!
$data = GET_BODY $url, 'Accept-Language', 'xy';
($lang) = $data =~ /Language as seen by Model code: (\w+)/;
ok( defined $lang && $lang eq 'xy' );
# if no lang is in the headers via Accept-Language we choice the default.
$data = GET_BODY $url;
($lang) = $data =~ /Language as seen by Model code: (\w+)/;
ok( defined $lang && $lang eq 'en' );
# verify that the page is delivered in english
ok( $data =~ qr~\Q<a href="language?pkit_lang=en">English</a>~
&& $data =~ qr~\Q<a href="language?pkit_lang=de">German</a>~ );
( run in 1.776 second using v1.01-cache-2.11-cpan-5467b0d2c73 )