overrode error message for 403 code to show elegant message for the user.

This commit is contained in:
Mark Beamer Jr 2018-09-15 20:55:03 -04:00 committed by Jeremy Kauffman
parent 305dc5d1e6
commit 39fcd109bb
2 changed files with 7 additions and 2 deletions

View file

@ -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'] ?? [],

View file

@ -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)