X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fsvc_acct.cgi;h=a7d5136fb2cedecb2daa05438cc603832de3bafc;hb=17f3013e588e4c574ee295cc8c555409be5cf9dd;hp=52701dfc4276d7d9c7c771dcedab0e7528bc411a;hpb=8bc81fd7828fd71281c6a3d7a9f4f6266498a302;p=freeside.git diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 52701dfc4..a7d5136fb 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -56,31 +56,47 @@ my $new = new FS::svc_acct ( \%hash ); my $error = ''; +# google captcha auth +if ( $cgi->param('captcha_response') ) { + my $part_svc = $svcnum ? + $old->part_svc : + qsearchs( 'part_svc', + { 'svcpart' => $cgi->param('svcpart') } + ); + my ($export) = $part_svc->part_export('acct_google'); + if ( $export and + ! $export->captcha_auth($cgi->param('captcha_response')) ) { + $error = 'Re-enter the security word.'; + } +} + $new->_password($old->_password) if $old; if ( $cgi->param('clear_password') eq '*HIDDEN*' || $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) { die "fatal: no previous account to recall hidden password from!" unless $old; } else { - $error = $new->set_password($cgi->param('clear_password')); + $error ||= $new->set_password($cgi->param('clear_password')); } -if ( $svcnum ) { - foreach ( grep { $old->$_ != $new->$_ } - qw( seconds upbytes downbytes totalbytes ) - ) - { - my %hash = map { $_ => $new->$_ } - grep { $new->$_ } - qw( seconds upbytes downbytes totalbytes ); +if ( ! $error ) { + if ( $svcnum ) { + foreach ( grep { $old->$_ != $new->$_ } + qw( seconds upbytes downbytes totalbytes ) + ) + { + my %hash = map { $_ => $new->$_ } + grep { $new->$_ } + qw( seconds upbytes downbytes totalbytes ); - $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^-?\d+$/ } keys %hash; - $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes - last; #once is enough + $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^-?\d+$/ } keys %hash; + $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes + last; #once is enough + } + $error ||= $new->replace($old); + } else { + $error ||= $new->insert; + $svcnum = $new->svcnum; } - $error ||= $new->replace($old); -} else { - $error ||= $new->insert; - $svcnum = $new->svcnum; }