summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authormark <mark>2011-03-16 01:43:29 +0000
committermark <mark>2011-03-16 01:43:29 +0000
commitb3e430d72c5988d2e8d7f0cb9e0548d745195da8 (patch)
treeb07b8c8349b00559a28855e6f497b88031f131ed /httemplate
parentd117f36952b5829085958d647f29bd3deac6acf5 (diff)
google account export tweaks, #11760
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/process/svc_acct.cgi48
-rwxr-xr-xhttemplate/edit/svc_acct.cgi12
2 files changed, 44 insertions, 16 deletions
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;
}
</%init>
diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi
index 0a191b445..2eb4a8b86 100755
--- a/httemplate/edit/svc_acct.cgi
+++ b/httemplate/edit/svc_acct.cgi
@@ -340,6 +340,12 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR>
</TABLE>
<BR>
+% if ( $captcha_url ) {
+<IMG SRC="<% $captcha_url %>"><BR>
+Enter the word shown above: <INPUT TYPE="text" NAME="captcha_response"><BR>
+<BR>
+% }
+
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
@@ -485,4 +491,10 @@ sub max {
(sort(@_))[-1]
}
+my $captcha_url;
+my ($export_google) = $part_svc->part_export('acct_google');
+if ( $export_google ) {
+ $captcha_url = $export_google->captcha_url || '';
+}
+
</%init>