RT mobile UI, #11630
[freeside.git] / rt / share / html / m / login
1 <%INIT>
2
3 my $req_uri;
4
5 if (UNIVERSAL::can($r, 'uri') and $r->uri =~ m{.*/m/(.*)}) {
6     $req_uri = '/m/'.$1;
7 }
8
9 my $default_path = RT->Config->Get('WebPath') ."/m/";
10
11 my $form_action = defined $goto             ? $goto
12                 : defined $req_uri          ? $req_uri
13                 :                             $default_path
14                 ;
15
16 # sanitize $form_action
17 my $uri = URI->new($form_action);
18
19 # You get undef scheme with a relative uri like "/Search/Build.html"
20 unless (!defined($uri->scheme) || $uri->scheme eq 'http' || $uri->scheme eq 'https') {
21     $form_action = $default_path;
22 }
23
24 # Make sure we're logging in to the same domain
25 # You can get an undef authority with a relative uri like "index.html"
26 my $uri_base_url = URI->new(RT->Config->Get('WebURL')."m/");
27 unless (!defined($uri->authority) || $uri->authority eq $uri_base_url->authority) {
28     $form_action = $default_path;
29 }
30 </%INIT>
31 <&| /m/_elements/wrapper, show_home_button => 0 &>
32 <style>
33 <& /m/_elements/raw_style &>
34 </style>
35 <h1><&|/l, RT->Config->Get('rtname') &>RT for [_1]</&></h1>
36 <div id="body" class="login-body">
37 % if ($Error) {
38 <&| "/Widgets/TitleBox", title => loc('Error'), hideable => 0, class => 'error'  &>
39 <% $Error %>
40 </&>
41 % }
42
43
44 <div id="login-box">
45 <&| /Widgets/TitleBox, title => loc('Login'), hideable => 0 &>
46
47 % unless (RT->Config->Get('WebExternalAuth') and !RT->Config->Get('WebFallbackToInternalAuth')) {
48 <form id="login" name="login" method="post" action="<% $form_action %>">
49
50 <div class="entry">
51     <span class="label"><&|/l&>Username</&>:</span><span class="value"><input name="user" value="<%$user%>" id="user" /></span>
52 </div>
53
54 <div class="entry">
55     <span class="label"><&|/l&>Password</&>:</span><span class="value"><input type="password" name="pass"/></span>
56 </div>
57
58 <& /Elements/Submit, Label => loc('Login')&>
59
60 % foreach my $key (keys %ARGS) {
61 %  if (($key ne 'user') and ($key ne 'pass')) {
62 %       if (ref($ARGS{$key}) =~ /ARRAY/) {
63 %               foreach my $val (@{$ARGS{$key}}) {
64 <input type="hidden" class="hidden" name="<%$key %>" value="<% $val %>" />
65 %               }
66 %       }
67 %       else {
68 <input type="hidden" class="hidden" name="<% $key %>" value="<% $ARGS{$key} %>" />
69 %       }
70 %  }
71 % }
72 </form>
73 % }
74 </&>
75 </div><!-- #login-box -->
76 </div><!-- #login-body -->
77 <& _elements/full_site_link &>
78 </&>
79 <%ARGS>
80 $user => ""
81 $pass => undef
82 $goto => undef
83 $Error => undef
84 </%ARGS>