From 787cb681305d093c471a81ccae1440e3eafd73cb Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Fri, 6 Jan 2017 09:09:55 -0800 Subject: [PATCH] replace redirects with http 302 --- controllers/controllers.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/controllers/controllers.php b/controllers/controllers.php index 4f150ce..d4f0233 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -11,14 +11,14 @@ function require_login(&$app, $redirect=true) { } catch(DomainException $e) { if($redirect) { header('X-Error: DomainException'); - $app->redirect('/', 301); + $app->redirect('/', 302); } else { return false; } } catch(UnexpectedValueException $e) { if($redirect) { header('X-Error: UnexpectedValueException'); - $app->redirect('/', 301); + $app->redirect('/', 302); } else { return false; } @@ -27,7 +27,7 @@ function require_login(&$app, $redirect=true) { if(!array_key_exists('user_id', $_SESSION)) { if($redirect) - $app->redirect('/'); + $app->redirect('/', 302); return false; } else { return ORM::for_table('users')->find_one($_SESSION['user_id']); @@ -225,13 +225,13 @@ $app->get('/add-to-home', function() use($app) { $data = JWT::decode($params['token'], Config::$jwtSecret, array('HS256')); $_SESSION['user_id'] = $data->user_id; $_SESSION['me'] = $data->me; - $app->redirect('/new', 301); + $app->redirect('/new', 302); } catch(DomainException $e) { header('X-Error: DomainException'); - $app->redirect('/', 301); + $app->redirect('/', 302); } catch(UnexpectedValueException $e) { header('X-Error: UnexpectedValueException'); - $app->redirect('/', 301); + $app->redirect('/', 302); } } else { @@ -246,7 +246,7 @@ $app->get('/add-to-home', function() use($app) { 'created_at' => time() ), Config::$jwtSecret); - $app->redirect('/add-to-home?token='.$token, 301); + $app->redirect('/add-to-home?token='.$token, 302); } else { unset($_SESSION['add-to-home-started']); render('add-to-home', array('title' => 'Quill'));