[tor-commits] [donate/master] Use subscriptionErrorUrl instead of referrer

peterh at torproject.org peterh at torproject.org
Tue May 11 21:17:51 UTC 2021


commit 5cbae9a0e12c7d6e5b60b94f8f8db7a93a3a044e
Author: Peter Haight <peterh at giantrabbit.com>
Date:   Wed Oct 21 10:22:35 2020 -0700

    Use subscriptionErrorUrl instead of referrer
    
    Tor has Referrer-Policy: no-referrer on their live server, so we can't
    use the referrer for going back to the page that sent the request.
---
 src/SubscriptionController.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/SubscriptionController.php b/src/SubscriptionController.php
index aaa9504a..38027066 100644
--- a/src/SubscriptionController.php
+++ b/src/SubscriptionController.php
@@ -102,9 +102,8 @@ class SubscriptionController extends BaseController {
       return $response->withRedirect($this->settings->get('subscriptionRequestSentUrl', '/subscription-request-sent'));
     } else {
       if (ArrayExt::fetch($parsedBody, 'returnToReferrer')) {
-        $referers = $request->getHeader("HTTP_REFERER");
-        $referer = reset($referers);
-        $uri = Uri::createFromString($referer);
+        $url = $this->settings->get('subscriptionErrorUrl');
+        $uri = Uri::createFromString($url);
         $uri->addQueryParam('errors', json_encode($errors));
         return $response->withRedirect($uri->toString());
       }





More information about the tor-commits mailing list