From 464d6da8fb57fe3e60e4c2c3cae6069bdafff6a5 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Aug 1999 07:40:45 +0000 Subject: initial checkin of signup server --- fs_signup/FS-SignupClient/Changes | 5 + fs_signup/FS-SignupClient/MANIFEST | 8 + fs_signup/FS-SignupClient/MANIFEST.SKIP | 1 + fs_signup/FS-SignupClient/Makefile.PL | 10 + fs_signup/FS-SignupClient/cgi/signup.cgi | 302 +++++++++++++++++++++++++++++++ fs_signup/FS-SignupClient/fs_signupd | 139 ++++++++++++++ fs_signup/FS-SignupClient/test.pl | 20 ++ 7 files changed, 485 insertions(+) create mode 100644 fs_signup/FS-SignupClient/Changes create mode 100644 fs_signup/FS-SignupClient/MANIFEST create mode 100644 fs_signup/FS-SignupClient/MANIFEST.SKIP create mode 100644 fs_signup/FS-SignupClient/Makefile.PL create mode 100755 fs_signup/FS-SignupClient/cgi/signup.cgi create mode 100755 fs_signup/FS-SignupClient/fs_signupd create mode 100644 fs_signup/FS-SignupClient/test.pl (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/Changes b/fs_signup/FS-SignupClient/Changes new file mode 100644 index 000000000..e750a82bc --- /dev/null +++ b/fs_signup/FS-SignupClient/Changes @@ -0,0 +1,5 @@ +Revision history for Perl extension FS::SignupClient. + +0.01 Mon Aug 23 01:12:46 1999 + - original version; created by h2xs 1.19 + diff --git a/fs_signup/FS-SignupClient/MANIFEST b/fs_signup/FS-SignupClient/MANIFEST new file mode 100644 index 000000000..b4a9900c8 --- /dev/null +++ b/fs_signup/FS-SignupClient/MANIFEST @@ -0,0 +1,8 @@ +Changes +MANIFEST +MANIFEST.SKIP +Makefile.PL +SignupClient.pm +test.pl +fs_signupd +cgi/signup.cgi diff --git a/fs_signup/FS-SignupClient/MANIFEST.SKIP b/fs_signup/FS-SignupClient/MANIFEST.SKIP new file mode 100644 index 000000000..ae335e78a --- /dev/null +++ b/fs_signup/FS-SignupClient/MANIFEST.SKIP @@ -0,0 +1 @@ +CVS/ diff --git a/fs_signup/FS-SignupClient/Makefile.PL b/fs_signup/FS-SignupClient/Makefile.PL new file mode 100644 index 000000000..859d757c3 --- /dev/null +++ b/fs_signup/FS-SignupClient/Makefile.PL @@ -0,0 +1,10 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +WriteMakefile( + 'NAME' => 'FS::SignupClient', + 'VERSION_FROM' => 'SignupClient.pm', # finds $VERSION + 'EXE_FILES' => [ 'fs_signupd' ], + 'INSTALLSCRIPT' => '/usr/local/sbin', + 'PERM_RWX' => '750', +); diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi new file mode 100755 index 000000000..7131ad2e8 --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -0,0 +1,302 @@ +#!/usr/bin/perl -Tw +# +# $Id: signup.cgi,v 1.1 1999-08-24 07:40:45 ivan Exp $ + +use strict; +use vars qw( @payby $cgi $locales $packages $pops $r $error + $last $first $ss $company $address1 $address2 $city $state $county + $country $zip $daytime $night $fax $invoicing_list $payby $payinfo + $paydate $payname $pkgpart $username $password $popnum ); +use subs qw( print_form print_okay expselect ); + +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::SignupClient qw( signup_info new_customer ); + +#@payby = qw( CARD BILL COMP ); +#@payby = qw( CARD BILL ); +@payby = qw( CARD ); + +( $locales, $packages, $pops ) = signup_info(); + +$cgi = new CGI; + +if ( defined $cgi->param('magic') ) { + if ( $cgi->param('magic') eq 'process' ) { + + $cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ + or die "Oops, illegal \"state\" param: ". $cgi->param('state'); + $state = $1; + $county = $3 || ''; + $country = $4; + + $payby = $cgi->param('payby'); + $payinfo = $cgi->param( $payby. '_payinfo' ); + $paydate = + $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ); + $payname = $cgi->param( $payby. '_payname' ); + + if ( $invoicing_list = $cgi->param('invoicing_list') ) { + $invoicing_list .= ', POST' if $cgi->param('invoicing_list_POST'); + } else { + $invoicing_list = 'POST'; + } + + ( $error = new_customer ( { + 'last' => $last = $cgi->param('last'), + 'first' => $first = $cgi->param('first'), + 'ss' => $ss = $cgi->param('ss'), + 'company' => $company = $cgi->param('company'), + 'address1' => $address1 = $cgi->param('address1'), + 'address2' => $address2 = $cgi->param('address2'), + 'city' => $city = $cgi->param('city'), + 'county' => $county, + 'state' => $state, + 'zip' => $zip = $cgi->param('zip'), + 'country' => $country, + 'daytime' => $daytime = $cgi->param('daytime'), + 'night' => $night = $cgi->param('night'), + 'fax' => $fax = $cgi->param('fax'), + 'payby' => $payby, + 'payinfo' => $payinfo, + 'paydate' => $paydate, + 'payname' => $payname, + 'invoicing_list' => $invoicing_list, + 'pkgpart' => $pkgpart = $cgi->param('pkgpart'), + 'username' => $username = $cgi->param('username'), + '_password' => $password = $cgi->param('_password'), + 'popnum' => $popnum = $cgi->param('popnum'), + } ) ) + ? print_form() + : print_okay(); + } else { + die "unrecognized magic: ". $cgi->param('magic'); + } +} else { + $error = ''; + $last = ''; + $first = ''; + $ss = ''; + $company = ''; + $address1 = ''; + $address2 = ''; + $city = ''; + $state = ''; + $county = ''; + $country = ''; + $zip = ''; + $daytime = ''; + $night = ''; + $fax = ''; + $invoicing_list = ''; + $payby = ''; + $payinfo = ''; + $paydate = ''; + $payname = ''; + $pkgpart = ''; + $username = ''; + $password = ''; + $popnum = ''; + + print_form; +} + +sub print_form { + + my $r = qq!*!; + my $self_url = $cgi->self_url; + + print $cgi->header( '-expires' => 'now' ), <ISP Signup form +ISP Signup form

+END + + print qq!Error: $error! if $error; + + print < + +Contact Information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
${r}Contact name
(last, first)
, + SS#
Company
${r}Address
 
${r}City${r}State/Country${r}Zip
Day Phone
Night Phone
Fax
$r required fields
+
Billing information +!; + + print <
+END + + print qq!Postal mail invoice
Email invoice ', + qq!
Billing type
+ + +END + + my %payby = ( + 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD"). qq!
${r}Name on card
!, + 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", "12-2037"). qq!
${r}Attention
!, + 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP"), + ); + + my %paybychecked = ( + 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD", $paydate). qq!
${r}Name on card
!, + 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", $paydate). qq!
${r}Attention
!, + 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP", $paydate), + ); + + for (@payby) { + print qq!!; + } else { + print qq!> $payby{$_}!; + } + } + + print <
$paybychecked{$_}
$r required fields for each billing type +

First package + + + + + + + + + + + + + + + + +
Username
Password + (blank to generate)
POP
+

+ +END + +} + +sub print_okay { + print $cgi->header( '-expires' => 'now' ), <Signup successful +Signup successful

+blah blah blah + + +END +} + +sub expselect { + my $prefix = shift; + my $date = shift || ''; + my( $m, $y ) = ( 0, 0 ); + if ( $date =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format + ( $m, $y ) = ( $2, $1 ); + } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $m, $y ) = ( $1, $3 ); + } + my $return = qq!!; + for ( 1999 .. 2037 ) { + $return .= " ); +my @cust_main_county = map { + chomp( my $taxnum = ); + chomp( my $state = ); + chomp( my $county = ); + chomp( my $country = ); + { + 'taxnum' => $taxnum, + 'state' => $state, + 'county' => $county, + 'country' => $country, + }; +} ( 1 .. $n_cust_main_county ); + +warn "[fs_signupd] Reading package definitions...\n" if $Debug; +chomp( my $n_part_pkg = ); +my @part_pkg = map { + chomp( my $pkgpart = ); + chomp( my $pkg = ); + { + 'pkgpart' => $pkgpart, + 'pkg' => $pkg, + }; +} ( 1 .. $n_part_pkg ); + +warn "[fs_signupd] Reading POPs...\n" if $Debug; +chomp( my $n_svc_acct_pop = ); +my @svc_acct_pop = map { + chomp( my $popnum = ); + chomp( my $city = ); + chomp( my $state = ); + chomp( my $ac = ); + chomp( my $exch = ); + { + 'popnum' => $popnum, + 'city' => $city, + 'state' => $state, + 'ac' => $ac, + 'exch' => $exch, + }; +} ( 1 .. $n_svc_acct_pop ); + +warn "[fs_signupd] Creating $fs_signupd_socket\n" if $Debug; +my $uaddr = sockaddr_un($fs_signupd_socket); +my $proto = getprotobyname('tcp'); +socket(Server,PF_UNIX,SOCK_STREAM,0) or die "socket: $!"; +unlink($fs_signupd_socket); +bind(Server, $uaddr) or die "bind: $!"; +listen(Server,SOMAXCONN) or die "listen: $!"; + +warn "[fs_signupd] Entering main loop...\n" if $Debug; +my $paddr; +for ( ; $paddr = accept(Client,Server); close Client) { + + chop( my $command = ); + + if ( $command eq "signup_info" ) { + warn "[fs_signupd] sending signup info...\n" if $Debug; + print Client join("\n", $n_cust_main_county, + map { + $_->{taxnum}, + $_->{state}, + $_->{county}, + $_->{country}, + } @cust_main_county + ), "\n"; + + print Client join("\n", $n_part_pkg, + map { + $_->{pkgpart}, + $_->{pkg}, + } @part_pkg + ), "\n"; + + print Client join("\n", $n_svc_acct_pop, + map { + $_->{popnum}, + $_->{city}, + $_->{state}, + $_->{ac}, + $_->{exch}, + } @svc_acct_pop + ), "\n"; + + } elsif ( $command eq "new_customer" ) { + warn "[fs_signupd] reading customer signup...\n" if $Debug; + my( + $first, $last, $ss, $company, $address1, $address2, $city, $county, + $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo, + $paydate, $payname, $invoicing_list, $pkgpart, $username, $password, + $popnum, + ) = map { scalar() } ( 1 .. 23 ); + + warn "[fs_signupd] sending customer data to remote server...\n" if $Debug; + print + $first, $last, $ss, $company, $address1, $address2, $city, $county, + $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo, + $paydate, $payname, $invoicing_list, $pkgpart, $username, $password, + $popnum, + ; + + warn "[fs_signupd] reading error from remote server...\n" if $Debug; + my $error = ; + + warn "[fs_signupd] sending error to local client...\n" if $Debug; + print Client $error; + + } else { + die "unexpected command from client: $command"; + } + +} + diff --git a/fs_signup/FS-SignupClient/test.pl b/fs_signup/FS-SignupClient/test.pl new file mode 100644 index 000000000..690f5840e --- /dev/null +++ b/fs_signup/FS-SignupClient/test.pl @@ -0,0 +1,20 @@ +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl test.pl' + +######################### We start with some black magic to print on failure. + +# Change 1..1 below to 1..last_test_to_print . +# (It may become useful if the test is moved to ./t subdirectory.) + +BEGIN { $| = 1; print "1..1\n"; } +END {print "not ok 1\n" unless $loaded;} +use FS::SignupClient; +$loaded = 1; +print "ok 1\n"; + +######################### End of black magic. + +# Insert your test code below (better if it prints "ok 13" +# (correspondingly "not ok 13") depending on the success of chunk 13 +# of the test code): + -- cgit v1.2.1 From 76b34eacaaa4237ef73b24a028a01b45020d77b3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Aug 1999 07:56:38 +0000 Subject: forgot this file! --- fs_signup/FS-SignupClient/SignupClient.pm | 215 ++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 fs_signup/FS-SignupClient/SignupClient.pm (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/SignupClient.pm b/fs_signup/FS-SignupClient/SignupClient.pm new file mode 100644 index 000000000..d3118467b --- /dev/null +++ b/fs_signup/FS-SignupClient/SignupClient.pm @@ -0,0 +1,215 @@ +package FS::SignupClient; + +use strict; +use vars qw($VERSION @ISA @EXPORT_OK $fs_signupd_socket); +use Exporter; +use Socket; +use IO::Handle; + +$VERSION = '0.01'; + +@ISA = qw( Exporter ); +@EXPORT_OK = qw( signup_info new_customer ); + +$fs_signupd_socket = "/usr/local/freeside/fs_signupd_socket"; + +$ENV{'PATH'} ='/usr/bin:/usr/ucb:/bin'; +$ENV{'SHELL'} = '/bin/sh'; +$ENV{'IFS'} = " \t\n"; +$ENV{'CDPATH'} = ''; +$ENV{'ENV'} = ''; +$ENV{'BASH_ENV'} = ''; + +my $freeside_uid = scalar(getpwnam('freeside')); +die "not running as the freeside user\n" if $> != $freeside_uid; + +=head1 NAME + +FS::SignupClient - Freeside signup client API + +=head1 SYNOPSIS + + use FS::SignupClient qw( signup_info new_customer ); + + ( $locales, $packages, $pops ) = signup_info; + + $error = new_customer ( { + 'first' => $first, + 'last' => $last, + 'ss' => $ss, + 'comapny' => $company, + 'address1' => $address1, + 'address2' => $address2, + 'city' => $city, + 'county' => $county, + 'state' => $state, + 'zip' => $zip, + 'country' => $country, + 'daytime' => $daytime, + 'night' => $night, + 'fax' => $fax, + 'payby' => $payby, + 'payinfo' => $payinfo, + 'paydate' => $paydate, + 'payname' => $payname, + 'invoicing_list' => $invoicing_list, + 'pkgpart' => $pkgpart, + 'username' => $username, + '_password' => $password, + 'popnum' => $popnum, + } ); + +=head1 DESCRIPTION + +This module provides an API for a remote signup server. + +It needs to be run as the freeside user. Because of this, the program which +calls these subroutines should be written very carefully. + +=head1 SUBROUTINES + +=over 4 + +=item signup_info + +Returns three array references of hash references. + +The first set of hash references is of allowable locales. Each hash reference +has the following keys: + taxnum + state + county + country + +The second set of hash references is of allowable packages. Each hash +reference has the following keys: + pkgpart + pkg + +The third set of hash references is of allowable POPs (Points Of Presence). +Each hash reference has the following keys: + popnum + city + state + ac + exch + +=cut + +sub signup_info { + socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; + connect(SOCK, sockaddr_un($fs_signupd_socket)) or die "connect: $!"; + print SOCK "signup_info\n"; + SOCK->flush; + + chop ( my $n_cust_main_county = ); + my @cust_main_county = map { + chop ( my $taxnum = ); + chop ( my $state = ); + chop ( my $county = ); + chop ( my $country = ); + { + 'taxnum' => $taxnum, + 'state' => $state, + 'county' => $county, + 'country' => $country, + }; + } 1 .. $n_cust_main_county; + + chop ( my $n_part_pkg = ); + my @part_pkg = map { + chop ( my $pkgpart = ); + chop ( my $pkg = ); + { + 'pkgpart' => $pkgpart, + 'pkg' => $pkg, + }; + } 1 .. $n_part_pkg; + + chop ( my $n_svc_acct_pop = ); + my @svc_acct_pop = map { + chop ( my $popnum = ); + chop ( my $city = ); + chop ( my $state = ); + chop ( my $ac = ); + chop ( my $exch = ); + { + 'popnum' => $popnum, + 'city' => $city, + 'state' => $state, + 'ac' => $ac, + 'exch' => $exch, + }; + } 1 .. $n_svc_acct_pop; + + close SOCK; + + \@cust_main_county, \@part_pkg, \@svc_acct_pop; +} + +=item new_customer HASHREF + +Adds a customer to the remote Freeside system. Requires a hash reference as +a paramater with the following keys: + first + last + ss + comapny + address1 + address2 + city + county + state + zip + country + daytime + night + fax + payby + payinfo + paydate + payname + invoicing_list + pkgpart + username + _password + popnum + +Returns a scalar error message, or the empty string for success. + +=cut + +sub new_customer { + my $hashref = shift; + + socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; + connect(SOCK, sockaddr_un($fs_signupd_socket)) or die "connect: $!"; + print SOCK "new_customer\n"; + + print SOCK join("\n", map { $hashref->{$_} } qw( + first last ss company address1 address2 city county state zip country + daytime night fax payby payinfo paydate payname invoicing_list + pkgpart username _password popnum + ) ), "\n"; + SOCK->flush; + + chop( my $error = ); + $error; +} + +=back + +=head1 VERSION + +$Id: SignupClient.pm,v 1.1 1999-08-24 07:56:38 ivan Exp $ + +=head1 BUGS + +=head1 SEE ALSO + +L, L, L + +=cut + +1; + -- cgit v1.2.1 From add9a2b100af10df0b5d4ed174c158d99358cee3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Dec 1999 12:03:03 +0000 Subject: beginning of IEAK support --- fs_signup/FS-SignupClient/cgi/signup.cgi | 80 ++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 7131ad2e8..15767c151 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,22 +1,34 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.1 1999-08-24 07:40:45 ivan Exp $ +# $Id: signup.cgi,v 1.2 1999-12-17 12:03:03 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error $last $first $ss $company $address1 $address2 $city $state $county $country $zip $daytime $night $fax $invoicing_list $payby $payinfo - $paydate $payname $pkgpart $username $password $popnum ); + $paydate $payname $pkgpart $username $password $popnum + $ieak_docroot $ieak_baseurl ); use subs qw( print_form print_okay expselect ); use CGI; use CGI::Carp qw(fatalsToBrowser); +use HTTP::Headers::UserAgent 2.00; use FS::SignupClient qw( signup_info new_customer ); +#acceptable payment methods +# #@payby = qw( CARD BILL COMP ); #@payby = qw( CARD BILL ); @payby = qw( CARD ); +#to enable ieak signups, you need to specify a directory in the web server's +#document space and the equivalent base URL +# +$ieak_docroot = "/var/www/sisd.420.am/freeside/ieak"; +$ieak_baseurl = "http://sisd.420.am/freeside/ieak"; + +#srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`); + ( $locales, $packages, $pops ) = signup_info(); $cgi = new CGI; @@ -265,13 +277,75 @@ END } sub print_okay { - print $cgi->header( '-expires' => 'now' ), <platform eq 'ia32' + && $user_agent->os =~ /^win/ + && ($user-agent->browser)[0] eq 'IE' + ) + { #send an IEAK config + my $username = $cgi->param('username'); + my $password = $cgi->param('_password'); + my $email_name = $cgi->param('first'). ' '. $cgi->param('last'); + my $ins_file = rand(4294967296). ".ins"; + open(INS_FILE, ">$ieak_docroot/$ins_file"); + print INS_FILE <redirect("$ieak_docroot/$ins_file"); + + } else { #send a simple confirmation + print $cgi->header( '-expires' => 'now' ), <Signup successful Signup successful

blah blah blah END + } } sub expselect { -- cgit v1.2.1 From 5e39e2d7963d6f8304e5afb5d8b5f50aa6eaaf14 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 Jan 2000 22:49:28 +0000 Subject: full phone number --- fs_signup/FS-SignupClient/SignupClient.pm | 4 +++- fs_signup/FS-SignupClient/fs_signupd | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/SignupClient.pm b/fs_signup/FS-SignupClient/SignupClient.pm index d3118467b..7c96609f6 100644 --- a/fs_signup/FS-SignupClient/SignupClient.pm +++ b/fs_signup/FS-SignupClient/SignupClient.pm @@ -133,12 +133,14 @@ sub signup_info { chop ( my $state = ); chop ( my $ac = ); chop ( my $exch = ); + chop ( my $loc = ); { 'popnum' => $popnum, 'city' => $city, 'state' => $state, 'ac' => $ac, 'exch' => $exch, + 'loc' => $loc, }; } 1 .. $n_svc_acct_pop; @@ -201,7 +203,7 @@ sub new_customer { =head1 VERSION -$Id: SignupClient.pm,v 1.1 1999-08-24 07:56:38 ivan Exp $ +$Id: SignupClient.pm,v 1.2 2000-01-28 22:49:28 ivan Exp $ =head1 BUGS diff --git a/fs_signup/FS-SignupClient/fs_signupd b/fs_signup/FS-SignupClient/fs_signupd index 972e3c7b4..f22ab15d4 100755 --- a/fs_signup/FS-SignupClient/fs_signupd +++ b/fs_signup/FS-SignupClient/fs_signupd @@ -57,12 +57,14 @@ my @svc_acct_pop = map { chomp( my $state = ); chomp( my $ac = ); chomp( my $exch = ); + chomp( my $loc = ); { 'popnum' => $popnum, 'city' => $city, 'state' => $state, 'ac' => $ac, 'exch' => $exch, + 'loc' => $loc, }; } ( 1 .. $n_svc_acct_pop ); @@ -105,6 +107,7 @@ for ( ; $paddr = accept(Client,Server); close Client) { $_->{state}, $_->{ac}, $_->{exch}, + $_->{loc}, } @svc_acct_pop ), "\n"; -- cgit v1.2.1 From b202e6a1fd3f2ef13f5bc8d77f44e2869083c494 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 Jan 2000 22:49:49 +0000 Subject: proper IEAK stuff --- fs_signup/FS-SignupClient/cgi/signup.cgi | 88 +++++++++++--------------------- 1 file changed, 30 insertions(+), 58 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 15767c151..6fccf11b1 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,19 +1,22 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.2 1999-12-17 12:03:03 ivan Exp $ +# $Id: signup.cgi,v 1.3 2000-01-28 22:49:49 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error $last $first $ss $company $address1 $address2 $city $state $county $country $zip $daytime $night $fax $invoicing_list $payby $payinfo $paydate $payname $pkgpart $username $password $popnum - $ieak_docroot $ieak_baseurl ); + $ieak_file $ieak_template $ac $exch $loc + ); + #$ieak_docroot $ieak_baseurl use subs qw( print_form print_okay expselect ); use CGI; use CGI::Carp qw(fatalsToBrowser); use HTTP::Headers::UserAgent 2.00; use FS::SignupClient qw( signup_info new_customer ); +use Text::Template; #acceptable payment methods # @@ -21,11 +24,20 @@ use FS::SignupClient qw( signup_info new_customer ); #@payby = qw( CARD BILL ); @payby = qw( CARD ); -#to enable ieak signups, you need to specify a directory in the web server's -#document space and the equivalent base URL -# -$ieak_docroot = "/var/www/sisd.420.am/freeside/ieak"; -$ieak_baseurl = "http://sisd.420.am/freeside/ieak"; +$ieak_file = '/usr/local/freeside/ieak.template'; + +if ( -e $ieak_file ) { + $ieak_template = new Text::Template ( TYPE => 'FILE', SOURCE => $ieak_file ) + or die "Couldn't construct template: $Text::Template::ERROR"; +} else { + $ieak_template = ''; +} + +# #to enable ieak signups, you need to specify a directory in the web server's +# #document space and the equivalent base URL +# # +# $ieak_docroot = "/var/www/sisd.420.am/freeside/ieak"; +# $ieak_baseurl = "http://sisd.420.am/freeside/ieak"; #srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`); @@ -277,65 +289,25 @@ END } sub print_okay { - $user_agent = new HTTP::Headers::UserAgnet $ENV{HTTP_USER_AGENT}; - if ( defined($ieak_docroot) - && defined($ieak_baseurl) - && defined($ieak_secret) + my $user_agent = new HTTP::Headers::UserAgnet $ENV{HTTP_USER_AGENT}; + if ( $ieak_template && $user_agent->platform eq 'ia32' && $user_agent->os =~ /^win/ - && ($user-agent->browser)[0] eq 'IE' + && ($user_agent->browser)[0] eq 'IE' ) { #send an IEAK config my $username = $cgi->param('username'); my $password = $cgi->param('_password'); my $email_name = $cgi->param('first'). ' '. $cgi->param('last'); - my $ins_file = rand(4294967296). ".ins"; - open(INS_FILE, ">$ieak_docroot/$ins_file"); - print INS_FILE <redirect("$ieak_docroot/$ins_file"); + print $cgi->header('application/x-Internet-signup'), + $ieak_template->fill_in(); + +# my $ins_file = rand(4294967296). ".ins"; +# open(INS_FILE, ">$ieak_docroot/$ins_file"); +# print INS_FILE <redirect("$ieak_docroot/$ins_file"); } else { #send a simple confirmation print $cgi->header( '-expires' => 'now' ), < Date: Mon, 31 Jan 2000 05:22:23 +0000 Subject: prepaid "internet cards" --- fs_signup/FS-SignupClient/cgi/signup.cgi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 6fccf11b1..961ad505a 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.3 2000-01-28 22:49:49 ivan Exp $ +# $Id: signup.cgi,v 1.4 2000-01-31 05:22:23 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error @@ -22,7 +22,8 @@ use Text::Template; # #@payby = qw( CARD BILL COMP ); #@payby = qw( CARD BILL ); -@payby = qw( CARD ); +#@payby = qw( CARD ); +@payby = qw( CARD PREPAY ); $ieak_file = '/usr/local/freeside/ieak.template'; @@ -220,12 +221,14 @@ END 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD"). qq!
${r}Name on card
!, 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", "12-2037"). qq!
${r}Attention
!, 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP"), + 'PREPAY' => qq!Prepaid card
${r}!, ); my %paybychecked = ( 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD", $paydate). qq!
${r}Name on card
!, 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", $paydate). qq!
${r}Attention
!, 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP", $paydate), + 'PREPAY' => qq!Prepaid card
${r}!, ); for (@payby) { -- cgit v1.2.1 From b812b5a4a664e0bd271392ae4a609b18e85ca6b6 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Feb 2000 07:44:00 +0000 Subject: fix some bugs in signup server --- fs_signup/FS-SignupClient/SignupClient.pm | 3 ++- fs_signup/FS-SignupClient/cgi/signup.cgi | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/SignupClient.pm b/fs_signup/FS-SignupClient/SignupClient.pm index 7c96609f6..5769c18fc 100644 --- a/fs_signup/FS-SignupClient/SignupClient.pm +++ b/fs_signup/FS-SignupClient/SignupClient.pm @@ -4,6 +4,7 @@ use strict; use vars qw($VERSION @ISA @EXPORT_OK $fs_signupd_socket); use Exporter; use Socket; +use FileHandle; use IO::Handle; $VERSION = '0.01'; @@ -203,7 +204,7 @@ sub new_customer { =head1 VERSION -$Id: SignupClient.pm,v 1.2 2000-01-28 22:49:28 ivan Exp $ +$Id: SignupClient.pm,v 1.3 2000-02-02 07:44:00 ivan Exp $ =head1 BUGS diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 961ad505a..e5cf6d050 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.4 2000-01-31 05:22:23 ivan Exp $ +# $Id: signup.cgi,v 1.5 2000-02-02 07:44:00 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error @@ -292,7 +292,7 @@ END } sub print_okay { - my $user_agent = new HTTP::Headers::UserAgnet $ENV{HTTP_USER_AGENT}; + my $user_agent = new HTTP::Headers::UserAgent $ENV{HTTP_USER_AGENT}; if ( $ieak_template && $user_agent->platform eq 'ia32' && $user_agent->os =~ /^win/ -- cgit v1.2.1 From ee2813f461f788e18c13bf0eabbf6bd242f51c2f Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 1 Mar 2000 08:14:30 +0000 Subject: cvs cruft --- fs_signup/FS-SignupClient/cgi/signup.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index e5cf6d050..48376c219 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.5 2000-02-02 07:44:00 ivan Exp $ +# $Id: signup.cgi,v 1.6 2000-03-01 08:14:30 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error -- cgit v1.2.1 From 11df841f26fa4b5f6531109cbf0db87a376cfc3c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 May 2000 23:57:57 +0000 Subject: Netscape CCK autoconfiguration support --- fs_signup/FS-SignupClient/cgi/signup.cgi | 67 ++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 21 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 48376c219..839ad333d 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,15 +1,15 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.6 2000-03-01 08:14:30 ivan Exp $ +# $Id: signup.cgi,v 1.7 2000-05-10 23:57:57 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error $last $first $ss $company $address1 $address2 $city $state $county $country $zip $daytime $night $fax $invoicing_list $payby $payinfo $paydate $payname $pkgpart $username $password $popnum - $ieak_file $ieak_template $ac $exch $loc + $ieak_file $ieak_template $cck_file $cck_template + $ac $exch $loc ); - #$ieak_docroot $ieak_baseurl use subs qw( print_form print_okay expselect ); use CGI; @@ -26,6 +26,7 @@ use Text::Template; @payby = qw( CARD PREPAY ); $ieak_file = '/usr/local/freeside/ieak.template'; +$cck_file = '/usr/local/freeside/cck.template'; if ( -e $ieak_file ) { $ieak_template = new Text::Template ( TYPE => 'FILE', SOURCE => $ieak_file ) @@ -33,14 +34,12 @@ if ( -e $ieak_file ) { } else { $ieak_template = ''; } - -# #to enable ieak signups, you need to specify a directory in the web server's -# #document space and the equivalent base URL -# # -# $ieak_docroot = "/var/www/sisd.420.am/freeside/ieak"; -# $ieak_baseurl = "http://sisd.420.am/freeside/ieak"; - -#srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`); +if ( -e $cck_file ) { + $cck_template = new Text::Template ( TYPE => 'FILE', SOURCE => $cck_file ) + or die "Couldn't construct template: $Text::Template::ERROR"; +} else { + $cck_template = ''; +} ( $locales, $packages, $pops ) = signup_info(); @@ -293,24 +292,41 @@ END sub print_okay { my $user_agent = new HTTP::Headers::UserAgent $ENV{HTTP_USER_AGENT}; + + $cgi->param('username') =~ /^(.+)$/ + or die "fatal: invalid username got past FS::SignupClient::new_customer"; + my $username = $1; + $cgi->param('_password') =~ /^(.+)$/ + or die "fatal: invalid password got past FS::SignupClient::new_customer"; + my $password = $1; + ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/ + or die "fatal: invalid email_name got past FS::SignupCLient::new_customer"; + my $email_name = $1; + + my $pop = pop_info($cgi->param('popnum')) + or die "fatal: invalid popnum got past FS::SignupClient::new_customer"; + my ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} ); + if ( $ieak_template && $user_agent->platform eq 'ia32' && $user_agent->os =~ /^win/ && ($user_agent->browser)[0] eq 'IE' ) { #send an IEAK config - my $username = $cgi->param('username'); - my $password = $cgi->param('_password'); - my $email_name = $cgi->param('first'). ' '. $cgi->param('last'); - print $cgi->header('application/x-Internet-signup'), $ieak_template->fill_in(); - -# my $ins_file = rand(4294967296). ".ins"; -# open(INS_FILE, ">$ieak_docroot/$ins_file"); -# print INS_FILE <redirect("$ieak_docroot/$ins_file"); + } elsif ( $cck_template + && $user_agent->platform eq 'ia32' + && $user_agent->os =~ /^win/ + && ($user_agent->browser)[0] eq 'Netscape' + ) + { #send a Netscape config + my $cck_data = $cck_template->fill_in(); + print $cgi->header('application/x-netscape-autoconfigure-dialer-v2'), + map { + m/(.*)\s+(.*)$/; + pack("N", length($1)). $1. pack("N", length($2)). $2; + } split(/\n/, $cck_data); } else { #send a simple confirmation print $cgi->header( '-expires' => 'now' ), <{'popnum'} == $popnum ) { return $pop; } + } + ''; +} + sub expselect { my $prefix = shift; my $date = shift || ''; -- cgit v1.2.1 From f01fe96a27912381d4b30ccad3d355d74f76f505 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 24 Aug 2000 07:26:50 +0000 Subject: untaint template source --- fs_signup/FS-SignupClient/cgi/signup.cgi | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 839ad333d..7576b8b42 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.7 2000-05-10 23:57:57 ivan Exp $ +# $Id: signup.cgi,v 1.8 2000-08-24 07:26:50 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error @@ -29,14 +29,22 @@ $ieak_file = '/usr/local/freeside/ieak.template'; $cck_file = '/usr/local/freeside/cck.template'; if ( -e $ieak_file ) { - $ieak_template = new Text::Template ( TYPE => 'FILE', SOURCE => $ieak_file ) - or die "Couldn't construct template: $Text::Template::ERROR"; + my $ieak_txt = Text::Template::_load_text($ieak_file) + or die $Text::Template::ERROR; + $ieak_txt =~ /^(.*)$/s; #untaint the template source - it's trusted + $ieak_txt = $1; + $ieak_template = new Text::Template ( TYPE => 'STRING', SOURCE => $ieak_txt ) + or die $Text::Template::ERROR; } else { $ieak_template = ''; } if ( -e $cck_file ) { - $cck_template = new Text::Template ( TYPE => 'FILE', SOURCE => $cck_file ) - or die "Couldn't construct template: $Text::Template::ERROR"; + my $cck_txt = Text::Template::_load_text($cck_file) + or die $Text::Template::ERROR; + $cck_txt =~ /^(.*)$/s; #untaint the template source - it's trusted + $cck_txt = $1; + $cck_template = new Text::Template ( TYPE => 'STRING', SOURCE => $cck_txt ) + or die $Text::Template::ERROR; } else { $cck_template = ''; } -- cgit v1.2.1 From 65dea21c4088a0dbf3e8863a6dadc39aed67d4db Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 Dec 2000 14:29:15 +0000 Subject: template bugfix from Jason Spence --- fs_signup/FS-SignupClient/cgi/signup.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 7576b8b42..a3fa9e788 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.8 2000-08-24 07:26:50 ivan Exp $ +# $Id: signup.cgi,v 1.9 2000-12-03 14:29:15 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error @@ -313,7 +313,7 @@ sub print_okay { my $pop = pop_info($cgi->param('popnum')) or die "fatal: invalid popnum got past FS::SignupClient::new_customer"; - my ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} ); + ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} ); if ( $ieak_template && $user_agent->platform eq 'ia32' -- cgit v1.2.1 From 5e99168da38e7616fc726242ce7d85e140f22c6f Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 28 Aug 2001 16:58:08 +0000 Subject: customer-to-customer referrals in singup server --- fs_signup/FS-SignupClient/SignupClient.pm | 60 ++++++++++++++++--------------- fs_signup/FS-SignupClient/cgi/signup.cgi | 58 ++++++++++++++++-------------- fs_signup/FS-SignupClient/fs_signupd | 10 +++--- 3 files changed, 67 insertions(+), 61 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/SignupClient.pm b/fs_signup/FS-SignupClient/SignupClient.pm index 5769c18fc..d656d7528 100644 --- a/fs_signup/FS-SignupClient/SignupClient.pm +++ b/fs_signup/FS-SignupClient/SignupClient.pm @@ -7,7 +7,7 @@ use Socket; use FileHandle; use IO::Handle; -$VERSION = '0.01'; +$VERSION = '0.02'; @ISA = qw( Exporter ); @EXPORT_OK = qw( signup_info new_customer ); @@ -35,29 +35,30 @@ FS::SignupClient - Freeside signup client API ( $locales, $packages, $pops ) = signup_info; $error = new_customer ( { - 'first' => $first, - 'last' => $last, - 'ss' => $ss, - 'comapny' => $company, - 'address1' => $address1, - 'address2' => $address2, - 'city' => $city, - 'county' => $county, - 'state' => $state, - 'zip' => $zip, - 'country' => $country, - 'daytime' => $daytime, - 'night' => $night, - 'fax' => $fax, - 'payby' => $payby, - 'payinfo' => $payinfo, - 'paydate' => $paydate, - 'payname' => $payname, - 'invoicing_list' => $invoicing_list, - 'pkgpart' => $pkgpart, - 'username' => $username, - '_password' => $password, - 'popnum' => $popnum, + 'first' => $first, + 'last' => $last, + 'ss' => $ss, + 'comapny' => $company, + 'address1' => $address1, + 'address2' => $address2, + 'city' => $city, + 'county' => $county, + 'state' => $state, + 'zip' => $zip, + 'country' => $country, + 'daytime' => $daytime, + 'night' => $night, + 'fax' => $fax, + 'payby' => $payby, + 'payinfo' => $payinfo, + 'paydate' => $paydate, + 'payname' => $payname, + 'invoicing_list' => $invoicing_list, + 'referral_custnum' => $referral_custnum, + 'pkgpart' => $pkgpart, + 'username' => $username, + '_password' => $password, + 'popnum' => $popnum, } ); =head1 DESCRIPTION @@ -173,6 +174,7 @@ a paramater with the following keys: paydate payname invoicing_list + referral_custnum pkgpart username _password @@ -185,6 +187,10 @@ Returns a scalar error message, or the empty string for success. sub new_customer { my $hashref = shift; + #things that aren't necessary in base class, but are for signup server + return "Empty password" unless $hashref->{'_password'}; + return "No POP selected" unless $hashref->{'popnum'}; + socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; connect(SOCK, sockaddr_un($fs_signupd_socket)) or die "connect: $!"; print SOCK "new_customer\n"; @@ -192,7 +198,7 @@ sub new_customer { print SOCK join("\n", map { $hashref->{$_} } qw( first last ss company address1 address2 city county state zip country daytime night fax payby payinfo paydate payname invoicing_list - pkgpart username _password popnum + referral_custnum pkgpart username _password popnum ) ), "\n"; SOCK->flush; @@ -202,10 +208,6 @@ sub new_customer { =back -=head1 VERSION - -$Id: SignupClient.pm,v 1.3 2000-02-02 07:44:00 ivan Exp $ - =head1 BUGS =head1 SEE ALSO diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index a3fa9e788..5d024a812 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,12 +1,13 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.9 2000-12-03 14:29:15 ivan Exp $ +# $Id: signup.cgi,v 1.10 2001-08-28 16:58:08 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $r $error $last $first $ss $company $address1 $address2 $city $state $county $country $zip $daytime $night $fax $invoicing_list $payby $payinfo - $paydate $payname $pkgpart $username $password $popnum + $paydate $payname $referral_custnum + $pkgpart $username $password $popnum $ieak_file $ieak_template $cck_file $cck_template $ac $exch $loc ); @@ -15,7 +16,7 @@ use subs qw( print_form print_okay expselect ); use CGI; use CGI::Carp qw(fatalsToBrowser); use HTTP::Headers::UserAgent 2.00; -use FS::SignupClient qw( signup_info new_customer ); +use FS::SignupClient 0.02 qw( signup_info new_customer ); use Text::Template; #acceptable payment methods @@ -75,29 +76,30 @@ if ( defined $cgi->param('magic') ) { } ( $error = new_customer ( { - 'last' => $last = $cgi->param('last'), - 'first' => $first = $cgi->param('first'), - 'ss' => $ss = $cgi->param('ss'), - 'company' => $company = $cgi->param('company'), - 'address1' => $address1 = $cgi->param('address1'), - 'address2' => $address2 = $cgi->param('address2'), - 'city' => $city = $cgi->param('city'), - 'county' => $county, - 'state' => $state, - 'zip' => $zip = $cgi->param('zip'), - 'country' => $country, - 'daytime' => $daytime = $cgi->param('daytime'), - 'night' => $night = $cgi->param('night'), - 'fax' => $fax = $cgi->param('fax'), - 'payby' => $payby, - 'payinfo' => $payinfo, - 'paydate' => $paydate, - 'payname' => $payname, - 'invoicing_list' => $invoicing_list, - 'pkgpart' => $pkgpart = $cgi->param('pkgpart'), - 'username' => $username = $cgi->param('username'), - '_password' => $password = $cgi->param('_password'), - 'popnum' => $popnum = $cgi->param('popnum'), + 'last' => $last = $cgi->param('last'), + 'first' => $first = $cgi->param('first'), + 'ss' => $ss = $cgi->param('ss'), + 'company' => $company = $cgi->param('company'), + 'address1' => $address1 = $cgi->param('address1'), + 'address2' => $address2 = $cgi->param('address2'), + 'city' => $city = $cgi->param('city'), + 'county' => $county, + 'state' => $state, + 'zip' => $zip = $cgi->param('zip'), + 'country' => $country, + 'daytime' => $daytime = $cgi->param('daytime'), + 'night' => $night = $cgi->param('night'), + 'fax' => $fax = $cgi->param('fax'), + 'payby' => $payby, + 'payinfo' => $payinfo, + 'paydate' => $paydate, + 'payname' => $payname, + 'invoicing_list' => $invoicing_list, + 'referral_custnum' => $referral_custnum = $cgi->param('ref'), + 'pkgpart' => $pkgpart = $cgi->param('pkgpart'), + 'username' => $username = $cgi->param('username'), + '_password' => $password = $cgi->param('_password'), + 'popnum' => $popnum = $cgi->param('popnum'), } ) ) ? print_form() : print_okay(); @@ -129,13 +131,14 @@ if ( defined $cgi->param('magic') ) { $username = ''; $password = ''; $popnum = ''; - + $referral_custnum = $cgi->param('ref') || ''; print_form; } sub print_form { my $r = qq!*!; + $cgi->delete('ref'); my $self_url = $cgi->self_url; print $cgi->header( '-expires' => 'now' ), < + Contact Information diff --git a/fs_signup/FS-SignupClient/fs_signupd b/fs_signup/FS-SignupClient/fs_signupd index f22ab15d4..8b3cdde53 100755 --- a/fs_signup/FS-SignupClient/fs_signupd +++ b/fs_signup/FS-SignupClient/fs_signupd @@ -116,16 +116,16 @@ for ( ; $paddr = accept(Client,Server); close Client) { my( $first, $last, $ss, $company, $address1, $address2, $city, $county, $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo, - $paydate, $payname, $invoicing_list, $pkgpart, $username, $password, - $popnum, - ) = map { scalar() } ( 1 .. 23 ); + $paydate, $payname, $invoicing_list, $referral_custnum, + $pkgpart, $username, $password, $popnum, + ) = map { scalar() } ( 1 .. 24 ); warn "[fs_signupd] sending customer data to remote server...\n" if $Debug; print $first, $last, $ss, $company, $address1, $address2, $city, $county, $state, $zip, $country, $daytime, $night, $fax, $payby, $payinfo, - $paydate, $payname, $invoicing_list, $pkgpart, $username, $password, - $popnum, + $paydate, $payname, $invoicing_list, $referral_custnum, + $pkgpart, $username, $password, $popnum, ; warn "[fs_signupd] reading error from remote server...\n" if $Debug; -- cgit v1.2.1 From 294b8c0914f497b7714bad51dfb000d33e843995 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Aug 2001 16:23:32 +0000 Subject: update signup server: template form and success html, document --- fs_signup/FS-SignupClient/cgi/signup.cgi | 382 ++++++++++++++++------------- fs_signup/FS-SignupClient/cgi/signup.html | 149 +++++++++++ fs_signup/FS-SignupClient/cgi/success.html | 4 + 3 files changed, 365 insertions(+), 170 deletions(-) create mode 100755 fs_signup/FS-SignupClient/cgi/signup.html create mode 100644 fs_signup/FS-SignupClient/cgi/success.html (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 5d024a812..0da960579 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,18 +1,19 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.10 2001-08-28 16:58:08 ivan Exp $ +# $Id: signup.cgi,v 1.11 2001-08-30 16:23:32 ivan Exp $ use strict; -use vars qw( @payby $cgi $locales $packages $pops $r $error +use vars qw( @payby $cgi $locales $packages $pops $error $last $first $ss $company $address1 $address2 $city $state $county $country $zip $daytime $night $fax $invoicing_list $payby $payinfo $paydate $payname $referral_custnum $pkgpart $username $password $popnum $ieak_file $ieak_template $cck_file $cck_template + $signup_html $signup_template $success_html $success_template $ac $exch $loc + $self_url ); -use subs qw( print_form print_okay expselect ); - +use subs qw( print_form print_okay expselect signup_default success_default ); use CGI; use CGI::Carp qw(fatalsToBrowser); use HTTP::Headers::UserAgent 2.00; @@ -28,6 +29,8 @@ use Text::Template; $ieak_file = '/usr/local/freeside/ieak.template'; $cck_file = '/usr/local/freeside/cck.template'; +$signup_html = '/usr/local/freeside/signup.html'; +$success_html = '/usr/local/freeside/success.html'; if ( -e $ieak_file ) { my $ieak_txt = Text::Template::_load_text($ieak_file) @@ -39,6 +42,7 @@ if ( -e $ieak_file ) { } else { $ieak_template = ''; } + if ( -e $cck_file ) { my $cck_txt = Text::Template::_load_text($cck_file) or die $Text::Template::ERROR; @@ -50,6 +54,42 @@ if ( -e $cck_file ) { $cck_template = ''; } +if ( -e $signup_html ) { + my $signup_txt = Text::Template::_load_text($signup_html) + or die $Text::Template::ERROR; + $signup_txt =~ /^(.*)$/s; #untaint the template source - it's trusted + $signup_txt = $1; + $signup_template = new Text::Template ( TYPE => 'STRING', + SOURCE => $signup_txt, + DELIMITERS => [ '<%=', '%>' ] + ) + or die $Text::Template::ERROR; +} else { + $signup_template = new Text::Template ( TYPE => 'STRING', + SOURCE => &signup_default, + DELIMITERS => [ '<%=', '%>' ] + ) + or die $Text::Template::ERROR; +} + +if ( -e $success_html ) { + my $success_txt = Text::Template::_load_text($signup_html) + or die $Text::Template::ERROR; + $success_txt =~ /^(.*)$/s; #untaint the template source - it's trusted + $success_txt = $1; + $success_template = new Text::Template ( TYPE => 'STRING', + SOURCE => $success_txt, + DELIMITERS => [ '<%=', '%>' ], + ) + or die $Text::Template::ERROR; +} else { + $success_template = new Text::Template ( TYPE => 'STRING', + SOURCE => &success_default, + DELIMITERS => [ '<%=', '%>' ], + ) + or die $Text::Template::ERROR; +} + ( $locales, $packages, $pops ) = signup_info(); $cgi = new CGI; @@ -137,168 +177,13 @@ if ( defined $cgi->param('magic') ) { sub print_form { - my $r = qq!*!; $cgi->delete('ref'); - my $self_url = $cgi->self_url; - - print $cgi->header( '-expires' => 'now' ), <ISP Signup form -ISP Signup form

-END - - print qq!Error: $error! if $error; - - print < - - -Contact Information -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
${r}Contact name
(last, first)
, - SS#
Company
${r}Address
 
${r}City${r}State/Country${r}Zip
Day Phone
Night Phone
Fax
$r required fields
-
Billing information -!; - - print <
-END - - print qq!Postal mail invoice
Email invoice ', - qq!
Billing type
- - -END - - my %payby = ( - 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD"). qq!
${r}Name on card
!, - 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", "12-2037"). qq!
${r}Attention
!, - 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP"), - 'PREPAY' => qq!Prepaid card
${r}!, - ); - - my %paybychecked = ( - 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD", $paydate). qq!
${r}Name on card
!, - 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", $paydate). qq!
${r}Attention
!, - 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP", $paydate), - 'PREPAY' => qq!Prepaid card
${r}!, - ); - - for (@payby) { - print qq!!; - } else { - print qq!> $payby{$_}!; - } - } + $self_url = $cgi->self_url; - print <
$paybychecked{$_}
$r required fields for each billing type -

First package - - - - - - - - - - - - - - - - -
Username
Password - (blank to generate)
POP
-

- -END + print $cgi->header( '-expires' => 'now' ), + $signup_template->fill_in(); } @@ -341,13 +226,8 @@ sub print_okay { } split(/\n/, $cck_data); } else { #send a simple confirmation - print $cgi->header( '-expires' => 'now' ), <Signup successful -Signup successful

-blah blah blah - - -END + print $cgi->header( '-expires' => 'now' ), + $success_template->fill_in(); } } @@ -386,3 +266,165 @@ sub expselect { $return; } +sub success_default { #html to use if you don't specify a success file + <<'END'; +Signup successful +Signup successful

+Thanks for signing up! + +END +} + +sub signup_default { #html to use if you don't specify a template file + <<'END'; +ISP Signup form +ISP Signup form

+<%= $error %> +
+ + + +Contact Information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*Contact name
(last, first)
, +
Company
*Address
 
*City*State/Country*Zip
Day Phone
Night Phone
Fax
* required fields
+
Billing information + + +
+ + <%= + $OUT .= ' + + Postal mail invoice +
Email invoice +
Billing type
+ + + + <%= + my %payby = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD"). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", "12-2037"). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), + 'PREPAY' => qq!Prepaid card
*!, + ); + + my %paybychecked = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD", $paydate). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", $paydate). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP", $paydate), + 'PREPAY' => qq!Prepaid card
*!, + ); + + for (@payby) { + $OUT .= qq!!; + } else { + $OUT .= qq!> $payby{$_}!; + } + } + %> + +
$paybychecked{$_}
* required fields for each billing type +

First package + + + + + + + + + + + + + + + + +
Username
Password + (blank to generate)
POP
+

+
+END +} diff --git a/fs_signup/FS-SignupClient/cgi/signup.html b/fs_signup/FS-SignupClient/cgi/signup.html new file mode 100755 index 000000000..bc02db230 --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/signup.html @@ -0,0 +1,149 @@ +ISP Signup form +ISP Signup form

+<%= $error %> +
+ + + +Contact Information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*Contact name
(last, first)
, +
Company
*Address
 
*City*State/Country*Zip
Day Phone
Night Phone
Fax
* required fields
+
Billing information + + +
+ + <%= + $OUT .= ' + + Postal mail invoice +
Email invoice +
Billing type
+ + + + <%= + my %payby = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD"). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", "12-2037"). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), + 'PREPAY' => qq!Prepaid card
*!, + ); + + my %paybychecked = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD", $paydate). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", $paydate). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP", $paydate), + 'PREPAY' => qq!Prepaid card
*!, + ); + + for (@payby) { + $OUT .= qq!!; + } else { + $OUT .= qq!> $payby{$_}!; + } + } + %> + +
$paybychecked{$_}
* required fields for each billing type +

First package + + + + + + + + + + + + + + + + +
Username
Password + (blank to generate)
POP
+

+
diff --git a/fs_signup/FS-SignupClient/cgi/success.html b/fs_signup/FS-SignupClient/cgi/success.html new file mode 100644 index 000000000..6bc2d1fd7 --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/success.html @@ -0,0 +1,4 @@ +Signup successful +Signup successful

+Thanks for signing up! + -- cgit v1.2.1 From fa0a72bfd08ec131523df6c40da96296ddadbb30 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 11:03:06 +0000 Subject: missing quote in new template --- fs_signup/FS-SignupClient/cgi/signup.cgi | 4 ++-- fs_signup/FS-SignupClient/cgi/signup.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'fs_signup/FS-SignupClient') diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 0da960579..4ed5bf7d9 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.11 2001-08-30 16:23:32 ivan Exp $ +# $Id: signup.cgi,v 1.12 2001-09-11 11:03:06 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $error @@ -414,7 +414,7 @@ Contact Information <%= foreach my $pop ( @{$pops} ) { - $OUT .= '