import of rt 3.0.4
[freeside.git] / rt / html / Elements / Login
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
10 %# from www.gnu.org.
11 %# 
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 %# General Public License for more details.
16 %# 
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <%INIT>
25 if ($m->request_comp->path =~ '^/REST/\d+\.\d+/') {
26     $r->content_type("text/plain");
27     $m->error_format("text");
28     $m->out("RT/$RT::VERSION 401 Credentials required\n");
29     $m->out("\n$Error\n") if $Error;
30     $m->abort;
31 }
32 </%INIT>
33
34 <& /Elements/Callback, %ARGS, _CallbackName => 'Header' &>
35 <& /Elements/Header, Title => loc('Login'), Focus => 'user' &>
36
37 <DIV ALIGN=CENTER>
38 % if ($Error) {
39 <& /Elements/TitleBoxStart, title => loc('Error') &>
40 <% $Error %>
41 <& /Elements/TitleBoxEnd &>
42 % }
43 <BR>
44 <& /Elements/TitleBoxStart, width=> "40%", titleright => loc("RT [_1]", $RT::VERSION), title => loc('Login') ,
45 contentbg=>"#cccccc" &>
46
47 % unless ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth) {
48 <FORM METHOD=POST ACTION="<% (UNIVERSAL::can($r, 'uri') && ($r->uri) =~ m!.*/(.*)!) %>" >
49 <TABLE BORDER=0 WIDTH=100%>
50 <TR ALIGN=RIGHT>
51 <TD ALIGN=RIGHT><&|/l&>Username</&>:</TD><TD ALIGN=LEFT><input name=user value="<%$user%>"></TD></TR>
52 <TR><TD ALIGN=RIGHT><&|/l&>Password</&>:</TD><TD ALIGN=LEFT><input type=password name=pass></TD></TR>
53 <TR><TD colspan=2 align=right>
54 <input type=submit Value="<&|/l&>Login</&>">
55 </TD></TR>
56 </TABLE>
57
58 %# Give callbacks a chance to add more control elements
59 <& /Elements/Callback, %ARGS &>
60
61 <&/Elements/TitleBoxEnd&>
62 % # From mason 1.0.1 forward, this doesn't work. in fact, it breaks things.
63 % # But on Mason 1.15 it's fixed again, so we still use it.
64 % # The code below iterates through everything in the passed in arguments
65 % # Preserving all the old parameters
66 % # This would be easier, except mason is 'smart' and calls multiple values
67 % # arrays rather than multiple hash keys
68 % my $key; my $val;
69 % foreach $key (keys %ARGS) {
70 %  if (($key ne 'user') and ($key ne 'pass')) {
71 %       if (ref($ARGS{$key}) =~ /ARRAY/) {
72 %               foreach $val (@{$ARGS{$key}}) {
73 <input type=hidden name="<%$key %>" value="<% $val %>">
74 %               }
75 %       }
76 %       else {
77 <input type="hidden" name="<% $key %>" value="<% $ARGS{$key} %>">
78 %       }
79 %  }
80 % }
81 </FORM>
82 % }
83 </DIV>
84
85 <BR>
86 <!-- TODO: not yet implemented
87 If you've forgotten your username or password, RT can <A
88 href="/NoAuth/Reminder.html">send you a reminder</a>.
89 -->
90 <BR>
91 <BR>
92 <BR>
93 <HR>
94 <&|/l, '2003'&>RT is &copy; Copyright 1996-[_1] Jesse Vincent &lt;jesse@bestpractical.com&gt;.  It is distributed under <a href="http://www.gnu.org/copyleft/gpl.html">Version 2 of the GNU General Public License.</a></&>
95
96 <%ARGS>
97 $user => ""
98 $pass => undef
99 $goto => undef
100 $Error => undef
101 </%ARGS>