From 39fcd109bb9ecc76c0ae62026623b8641cbb91e7 Mon Sep 17 00:00:00 2001 From: Mark Beamer Jr Date: Sat, 15 Sep 2018 20:55:03 -0400 Subject: [PATCH] overrode error message for 403 code to show elegant message for the user. --- controller/action/MailActions.class.php | 6 +++++- lib/thirdparty/LBRY.class.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/controller/action/MailActions.class.php b/controller/action/MailActions.class.php index 165765b9..d4b2095c 100644 --- a/controller/action/MailActions.class.php +++ b/controller/action/MailActions.class.php @@ -62,7 +62,11 @@ class MailActions extends Actions public static function editEmailSettings(string $token) { - $response = LBRY::emailStatus($token); + list($status, $headers, $response) = LBRY::emailStatus($token); + if( $status == 403){ + //Catch 403 to return elegant error message. + $response['error'] = "This email link is invalid. If you clicked this from an older email it may have been expired for security purposes. Please email help@lbry.io for a valid one."; + } $responseData = $response['data'] ?? []; return ['mail/settings', [ 'emails' => $responseData['emails'] ?? [], diff --git a/lib/thirdparty/LBRY.class.php b/lib/thirdparty/LBRY.class.php index 28284cb4..4c9e860a 100644 --- a/lib/thirdparty/LBRY.class.php +++ b/lib/thirdparty/LBRY.class.php @@ -32,7 +32,8 @@ class LBRY public static function emailStatus($token) { - return Curl::post(static::getApiUrl('/user/email/status'),['auth_token' => $token], ['json_response' => true]); + list($status, $headers, $body) = Curl::doCurl(Curl::POST, static::getApiUrl('/user/email/status'),['auth_token' => $token], ['json_response' => true]); + return array($status,$headers,$body); } public static function applyTags($type, $token, $tags)