diff options
Diffstat (limited to 'fs_selfservice/FS-SelfService/cgi')
| -rw-r--r-- | fs_selfservice/FS-SelfService/cgi/login.html | 76 | ||||
| -rw-r--r-- | fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 23 |
2 files changed, 83 insertions, 16 deletions
diff --git a/fs_selfservice/FS-SelfService/cgi/login.html b/fs_selfservice/FS-SelfService/cgi/login.html index 5607de783..e5daec859 100644 --- a/fs_selfservice/FS-SelfService/cgi/login.html +++ b/fs_selfservice/FS-SelfService/cgi/login.html @@ -1,29 +1,85 @@ <HTML><HEAD><TITLE>Login</TITLE></HEAD> <BODY BGCOLOR="#e8e8e8"><FONT SIZE=5>Login</FONT><BR><BR> <FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT> + <FORM ACTION="<%= $self_url %>" METHOD=POST> <INPUT TYPE="hidden" NAME="session" VALUE="login"> + <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=2 CELLPADDING=0> + <TR> <TH ALIGN="right">Username </TH> <TD> - <INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"> - </TD> -</TR> -<TR> - <TH ALIGN="right">Domain </TH> - <TD> - <INPUT TYPE="text" NAME="domain" VALUE="<%= $domain %>"> + <INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"><%= $single_domain ? '@'.$single_domain : '' %> </TD> </TR> -<!--<INPUT TYPE="hidden" NAME="domain" VALUE="myisp.com">--> + +<%= +if ( $single_domain ) { + + $OUT .= qq(<INPUT TYPE="hidden" NAME="domain" VALUE="$single_domain">); + +} else { + + $OUT .= qq( + <TR> + <TH ALIGN="right">Domain </TH> + <TD> + <INPUT TYPE="text" NAME="domain" VALUE="$domain"> + </TD> + </TR> + ); + +} + +%> + <TR> <TH ALIGN="right">Password </TH> <TD> <INPUT TYPE="password" NAME="password"> </TD> </TR> +<TR> + <TD COLSPAN=2 ALIGN="center"><INPUT TYPE="submit" VALUE="Login"></TD> +</TR> </TABLE> -<BR><BR><INPUT TYPE="submit" VALUE="Login"> -</FORM></BODY></HTML> +</FORM> + +<%= + +if ( $phone_login ) { + + $OUT .= qq( + + <B>OR</B><BR><BR> + + <FORM ACTION="$self_url" METHOD=POST> + <INPUT TYPE="hidden" NAME="session" VALUE="login"> + <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=2 CELLPADDING=0> + <TR> + <TH ALIGN="right">Phone number </TH> + <TD> + <INPUT TYPE="text" NAME="username" VALUE="$username"> + </TD> + </TR> + <INPUT TYPE="hidden" NAME="domain" VALUE="svc_phone"> + <TR> + <TH ALIGN="right">PIN </TH> + <TD> + <INPUT TYPE="password" NAME="password"> + </TD> + </TR> + <TR> + <TD COLSPAN=2 ALIGN="center"><INPUT TYPE="submit" VALUE="Login"></TD> + </TR> + </TABLE> + </FORM> + + ); + +} + +%> +</BODY></HTML> diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index 539877bf2..cd81aeb8d 100644 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -9,7 +9,7 @@ use Text::Template; use HTML::Entities; use Date::Format; use Number::Format 1.50; -use FS::SelfService qw( login customer_info edit_info invoice +use FS::SelfService qw( login_info login customer_info edit_info invoice payment_info process_payment process_prepay list_pkgs order_pkg signup_info order_recharge @@ -28,7 +28,9 @@ $form_max = 255; $cgi = new CGI; unless ( defined $cgi->param('session') ) { - do_template('login',{}); + my $login_info = login_info(); + + do_template('login', $login_info ); exit; } @@ -52,10 +54,12 @@ if ( $cgi->param('session') eq 'login' ) { 'password' => $password, ); if ( $rv->{error} ) { + my $login_info = login_info(); do_template('login', { 'error' => $rv->{error}, 'username' => $username, 'domain' => $domain, + %$login_info, } ); exit; } else { @@ -81,7 +85,10 @@ die $@ if $@; if ( $result->{error} eq "Can't resume session" || $result->{error} eq "Expired session" ) { #ick - do_template('login',{}); + my $login_info = login_info(); + use Data::Dumper; + warn Dumper($login_info); + do_template('login', $login_info); exit; } @@ -620,12 +627,16 @@ sub do_template { $fill_in->{'selfurl'} = $cgi->self_url; $fill_in->{'cgi'} = \$cgi; - my $template = new Text::Template( TYPE => 'FILE', - SOURCE => "$template_dir/$name.html", + my $source = "$template_dir/$name.html"; + #warn "creating template for $source\n"; + my $template = new Text::Template( TYPE => 'FILE', + SOURCE => $source, DELIMITERS => [ '<%=', '%>' ], - UNTAINT => 1, ) + UNTAINT => 1, + ) or die $Text::Template::ERROR; + #warn "filling in $template with $fill_in\n"; print $cgi->header( '-expires' => 'now' ), $template->fill_in( PACKAGE => 'FS::SelfService::_selfservicecgi', HASH => $fill_in |
