blob: b787a3eeaa8246f7da40a0aa8c950a8aacc63bfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<& /elements/header-minimal.html, 'Login' &>
<link href="<%$url_string%>elements/freeside.css" type="text/css" rel="stylesheet">
<CENTER>
<BR>
<FONT SIZE=5>Login</FONT>
<BR><BR>
% if ( $error ) {
<FONT SIZE="+1" COLOR="#ff0000"><% $error |h %></FONT>
<BR><BR>
% }
%# <FORM METHOD="POST" ACTION="<%$url_string%>loginout/login">
% my $uri = $r->prev->uri;
% $uri .= '?'. $r->prev->args if length( $r->prev->args );
<FORM METHOD="POST" ACTION="/login">
<INPUT TYPE="hidden" NAME="destination" VALUE="<% $uri %>">
<TABLE CELLSPACING=0 CELLPADDING=4 CLASS="fsinnerbox">
<TR>
<TD ALIGN="right">Username: </TD>
<TD><INPUT TYPE="text" NAME="credential_0" SIZE="13"></TD>
</TR>
<TR>
<TD ALIGN="right">Password: </TD>
<TD><INPUT TYPE="password" NAME="credential_1" SIZE="13"></TD>
</TR>
</TABLE>
<BR>
<INPUT TYPE="submit" VALUE="Login">
</FORM>
</CENTER>
</BODY></HTML>
<%init>
my %error = (
'no_cookie' => '', #First login, don't display an error
'bad_cookie' => 'Bad Cookie', #timed out?
'bad_credentials' => 'Incorrect username / password',
#'logout' => 'You have been logged out.',
);
my $error = # $cgi->param('logout') ||
$r->prev->subprocess_env('AuthCookieReason');
$error = exists($error{$error}) ? $error{$error} : $error;
my $url_string = $r->uri;
#fake a freeside path for /login so we get our .css. shrug
$url_string =~ s/login$/freeside\/login/ unless $url_string =~ /freeside\//;
#even though this is kludgy and false laziness w/CGI.pm
$url_string =~ s{ / index\.html /? $ }
{/}x;
$url_string =~
s{
/(login|loginout)
([\w\-\.\/]*)
$
}
{}ix;
$url_string .= '/' unless $url_string =~ /\/$/;
</%init>
|