diff options
| author | mark <mark> | 2011-04-30 21:20:50 +0000 | 
|---|---|---|
| committer | mark <mark> | 2011-04-30 21:20:50 +0000 | 
| commit | 41d0660124cf3965a4a2b4706d02e382ac4cbf01 (patch) | |
| tree | c8d68353d466eebf37ff7d4f4564f3d20ac0b91d | |
| parent | 948efea2aa4d4eb05e3d8f6f5402b3bf825759bf (diff) | |
better error handling in google export, #12064
| -rw-r--r-- | FS/FS/part_export/acct_google.pm | 15 | ||||
| -rwxr-xr-x | httemplate/edit/svc_acct.cgi | 10 | 
2 files changed, 18 insertions, 7 deletions
| diff --git a/FS/FS/part_export/acct_google.pm b/FS/FS/part_export/acct_google.pm index c64d293a9..afc45db81 100644 --- a/FS/FS/part_export/acct_google.pm +++ b/FS/FS/part_export/acct_google.pm @@ -89,15 +89,18 @@ sub _export_unsuspend {    );  } -sub captcha_url { +sub auth_error {    my $self = shift;    my $google = $self->google_handle; -  if (exists ($google->{'captcha_url'}) ) { -    return 'http://www.google.com/accounts/'.$google->{'captcha_url'}; -  } -  else { -    return ''; +  if ( $google->{'error'} ) { +    my $url = $google->{'captcha_url'} || ''; +    $url = "http://www.google.com/accounts/$url" if $url; +    return { 'captcha_url' => $url, +             'message'     =>  +               'Unable to connect to the Google API: '.$google->{'error'}.'.', +           };    } +  return; #nothing on success  }  sub captcha_auth { diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 2eb4a8b86..f2b8e0c4a 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -494,7 +494,15 @@ sub max {  my $captcha_url;  my ($export_google) = $part_svc->part_export('acct_google');  if ( $export_google ) { -  $captcha_url = $export_google->captcha_url || ''; +  my $error = $export_google->auth_error; +  if ( $error ) { +    if ( $error->{'captcha_url'} ) { +      $captcha_url = $error->{'captcha_url'}; +    } +    else { +      $cgi->param('error', $error->{'message'}); +    } +  } #if $error  }  </%init> | 
