From 7fcc634a74d9c87c268f799c25812500d5067ea6 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 25 Oct 2016 17:29:37 +0300 Subject: [PATCH] Redirect to dashboard when switching accounts if viewing an entity --- app/Http/Controllers/UserController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index cec0bbcba8..b2d587c1a8 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -338,7 +338,13 @@ class UserController extends BaseController } } - return Redirect::to($referer); + // If the user is looking at an entity redirect to the dashboard + preg_match('/\/[0-9*][\/edit]*$/', $referer, $matches); + if (count($matches)) { + return Redirect::to('/dashboard'); + } else { + return Redirect::to($referer); + } } public function unlinkAccount($userAccountId, $userId)