From 1414b6b84954939b2f120443ab90a75d1ffb2a65 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 1 Mar 2010 14:40:39 -0500 Subject: send smaller error pages for OMB API endpoints --- actions/updateprofile.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actions/updateprofile.php') diff --git a/actions/updateprofile.php b/actions/updateprofile.php index e416a6fa9..dfc31f542 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -55,6 +55,8 @@ class UpdateprofileAction extends Action */ function prepare($argarray) { + StatusNet::setApi(true); // Send smaller error pages + parent::prepare($argarray); $license = $_POST['omb_listenee_license']; $site_license = common_config('license', 'url'); -- cgit v1.2.3-54-g00ecf From c7d8641e7dcb2af0ab9ad682f64c5ebc45fbbeae Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 1 Mar 2010 15:31:20 -0500 Subject: return correct HTTP status code for OMB errors --- actions/postnotice.php | 8 ++++++++ actions/updateprofile.php | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'actions/updateprofile.php') diff --git a/actions/postnotice.php b/actions/postnotice.php index f092d54d1..ad3f00e34 100644 --- a/actions/postnotice.php +++ b/actions/postnotice.php @@ -74,6 +74,14 @@ class PostnoticeAction extends Action $srv = new OMB_Service_Provider(null, omb_oauth_datastore(), omb_oauth_server()); $srv->handlePostNotice(); + } catch (OMB_RemoteServiceException $rse) { + $msg = $rse->getMessage(); + if (preg_match('/^Revoked accesstoken/', $msg) || + preg_match('/^No subscriber/', $msg)) { + $this->clientError($msg, 403); + } else { + $this->clientError($msg); + } } catch (Exception $e) { $this->serverError($e->getMessage()); return; diff --git a/actions/updateprofile.php b/actions/updateprofile.php index dfc31f542..44fafdd92 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -77,6 +77,14 @@ class UpdateprofileAction extends Action $srv = new OMB_Service_Provider(null, omb_oauth_datastore(), omb_oauth_server()); $srv->handleUpdateProfile(); + } catch (OMB_RemoteServiceException $rse) { + $msg = $rse->getMessage(); + if (preg_match('/^Revoked accesstoken/', $msg) || + preg_match('/^No subscriber/', $msg)) { + $this->clientError($msg, 403); + } else { + $this->clientError($msg); + } } catch (Exception $e) { $this->serverError($e->getMessage()); return; -- cgit v1.2.3-54-g00ecf From 656a977016701e7a0a1f936909cd7d4a5975f5be Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 1 Mar 2010 15:39:41 -0500 Subject: remove strict check on OMB exception strings --- actions/postnotice.php | 4 ++-- actions/updateprofile.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'actions/updateprofile.php') diff --git a/actions/postnotice.php b/actions/postnotice.php index ad3f00e34..b2f6f1bb9 100644 --- a/actions/postnotice.php +++ b/actions/postnotice.php @@ -76,8 +76,8 @@ class PostnoticeAction extends Action $srv->handlePostNotice(); } catch (OMB_RemoteServiceException $rse) { $msg = $rse->getMessage(); - if (preg_match('/^Revoked accesstoken/', $msg) || - preg_match('/^No subscriber/', $msg)) { + if (preg_match('/Revoked accesstoken/', $msg) || + preg_match('/No subscriber/', $msg)) { $this->clientError($msg, 403); } else { $this->clientError($msg); diff --git a/actions/updateprofile.php b/actions/updateprofile.php index 44fafdd92..bae6108cc 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -79,8 +79,8 @@ class UpdateprofileAction extends Action $srv->handleUpdateProfile(); } catch (OMB_RemoteServiceException $rse) { $msg = $rse->getMessage(); - if (preg_match('/^Revoked accesstoken/', $msg) || - preg_match('/^No subscriber/', $msg)) { + if (preg_match('/Revoked accesstoken/', $msg) || + preg_match('/No subscriber/', $msg)) { $this->clientError($msg, 403); } else { $this->clientError($msg); -- cgit v1.2.3-54-g00ecf