use IO::Handle;
use Storable qw(nstore_fd fd_retrieve);
-$VERSION = '0.02';
+$VERSION = '0.03';
@ISA = qw( Exporter );
@EXPORT_OK = qw( signup_info new_customer );
ac
exch
+(Future expansion: fourth argument is the $init_data hash reference)
+
=cut
sub signup_info {
pkgpart
username
_password
+ sec_phrase
popnum
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 "Passwords don't match"
-# if $hashref->{'_password'} ne $hashref->{'_password2'}
- 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";
my $signup_data = { map { $_ => $hashref->{$_} } qw(
first last ss company address1 address2 city county state zip country
daytime night fax payby payinfo paydate payname invoicing_list
- referral_custnum pkgpart username _password popnum
+ referral_custnum pkgpart username _password sec_phrase popnum
) };
- #
nstore_fd($signup_data, \*SOCK) or die "can't send customer signup: $!";
SOCK->flush;
#!/usr/bin/perl -Tw
#
-# $Id: signup.cgi,v 1.16 2002-04-06 20:37:38 ivan Exp $
+# $Id: signup.cgi,v 1.17 2002-04-06 21:39:22 ivan Exp $
use strict;
-use vars qw( @payby $cgi $locales $packages $pops $error
+use vars qw( @payby $cgi $locales $packages $pops $init_data $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 $password2 $popnum
+ $pkgpart $username $password $password2 $sec_phrase $popnum
$ieak_file $ieak_template $cck_file $cck_template
$signup_html $signup_template $success_html $success_template
$ac $exch $loc
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use HTTP::Headers::UserAgent 2.00;
-use FS::SignupClient 0.02 qw( signup_info new_customer );
+use FS::SignupClient 0.03 qw( signup_info new_customer );
use Text::Template;
#acceptable payment methods
or die $Text::Template::ERROR;
}
-( $locales, $packages, $pops ) = signup_info();
+( $locales, $packages, $pops, $init_data ) = signup_info();
$cgi = new CGI;
'referral_custnum' => $referral_custnum = $cgi->param('ref'),
'pkgpart' => $pkgpart = $cgi->param('pkgpart'),
'username' => $username = $cgi->param('username'),
+ 'sec_phrase' => $sec_phrase = $cgi->param('sec_phrase'),
'_password' => $password = $cgi->param('_password'),
'popnum' => $popnum = $cgi->param('popnum'),
} );
$username = '';
$password = '';
$password2 = '';
+ $sec_phrase = '';
$popnum = '';
$referral_custnum = $cgi->param('ref') || '';
print_form;
<TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>">
</TD>
</TR>
+<%=
+ if ( $init_data->{'security_phrase'} ) {
+ $OUT .= <<ENDOUT;
+<TR>
+ <TD ALIGN="right">Security Phrase</TD>
+ <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
+ </TD>
+</TR>
+ENDOUT
+ } else {
+ $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
+ }
+%>
<TR>
<TD ALIGN="right">Access number</TD>
<TD><%= popselector($popnum) %></TD>
<TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>">
</TD>
</TR>
+<%=
+ if ( $init_data->{'security_phrase'} ) {
+ $OUT .= <<ENDOUT;
+<TR>
+ <TD ALIGN="right">Security Phrase</TD>
+ <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
+ </TD>
+</TR>
+ENDOUT
+ } else {
+ $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
+ }
+%>
<TR>
<TD ALIGN="right">Access number</TD>
<TD><%= popselector($popnum) %></TD>
use Tie::RefHash;
use Net::SSH qw(sshopen2);
use FS::UID qw(adminsuidsetup);
+use FS::Conf;
use FS::Record qw( qsearch qsearchs );
use FS::cust_main_county;
use FS::cust_main;
my $user = shift or die &usage;
&adminsuidsetup( $user );
+my $conf = new FS::Conf;
+
my $machine = shift or die &usage;
my $agentnum = shift or die &usage;
'svc_acct_pop' => [ map { $_->hashref } qsearch ('svc_acct_pop',{} ) ],
+ 'security_phrase' => $conf->exists('security_phrase'),
+
};
warn "[fs_signup_server] Sending init data...\n" if $Debug;
my $error = '';
+ #things that aren't necessary in base class, but are for signup server
+ #return "Passwords don't match"
+ # if $hashref->{'_password'} ne $hashref->{'_password2'}
+ $error ||= "Empty password" unless $signup_data->{'_password'};
+ $error ||= "No POP selected" unless $signup_data->{'popnum'};
+
#shares some stuff with htdocs/edit/process/cust_main.cgi... take any
# common that are still here and library them.
my $cust_main = new FS::cust_main ( {
} );
- $error = "Illegal payment type"
+ $error ||= "Illegal payment type"
unless grep { $_ eq $signup_data->{'payby'} } @payby;
my @invoicing_list = split( /\s*\,\s*/, $signup_data->{'invoicing_list'} );
my $svc_acct = new FS::svc_acct ( {
'svcpart' => $svcpart,
- map { $_ => $signup_data->{$_} } qw( username _password popnum ),
+ map { $_ => $signup_data->{$_} }
+ qw( username _password sec_phrase popnum ),
} );
my $y = $svc_acct->setdefault; # arguably should be in new method