Subject: | login.xsp example script errors |
In the login.xsp page provided with this module, there are two errors.
The line which sets the $dest variable (which in turn sets the value of the hidden form field) currently reads:
my $dest = Apache::Request->instance($r)->param->{'destination'} || <auth:get-location/>;
This causes a fatal error:
"The following error occurred: Not a HASH reference at (eval 997) line 136"
In order to access the 'destination' paramater, The line should actually read:
my $dest = Apache::Request->instance($r)->param->{'destination'} || <auth:get-location/>;
The second error is rather minor:
if (<auth:is-logged-in/>) {
<h1>Welcome!</h1>
<p>You are logged on as: <auth:get-access type="user"/></p>
} else {
<h1>Logon</h1>
if ($form_complete) {
if ($form_username eq $correct_username and <auth:password-matches>
<auth:clear><xsp:expr>$form_password</xsp:expr></auth:clear>
<auth:encrypted><xsp:expr>$crypted_password</xsp:expr></auth:encrypted>
</auth:password-matches>) {
<auth:login>
<auth:access type="user"><xsp:expr>$form_username</xsp:expr></auth:access>
<auth:access type="level"><xsp:expr>$level</xsp:expr></auth:access>
<xsp:logic>
foreach my $group (@groups) {
<auth:access type="group"><xsp:expr>$group</xsp:expr></auth:access>
}
</xsp:logic>
</auth:login>
}
}
<p>User unknown or wrong password.</p>
}
should read:
if (<auth:is-logged-in/>) {
<h1>Welcome!</h1>
<p>You are logged on as: <auth:get-access type="user"/></p>
} else {
<h1>Logon</h1>
if ($form_complete) {
if ($form_username eq $correct_username and <auth:password-matches>
<auth:clear><xsp:expr>$form_password</xsp:expr></auth:clear>
<auth:encrypted><xsp:expr>$crypted_password</xsp:expr></auth:encrypted>
</auth:password-matches>) {
<auth:login>
<auth:access type="user"><xsp:expr>$form_username</xsp:expr></auth:access>
<auth:access type="level"><xsp:expr>$level</xsp:expr></auth:access>
<xsp:logic>
foreach my $group (@groups) {
<auth:access type="group"><xsp:expr>$group</xsp:expr></auth:access>
}
</xsp:logic>
</auth:login>
}
<p>User unknown or wrong password.</p>
}
}
(the difference being the postion of the line "<p>User unknown or wrong password.</p>".