1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-20 09:52:17 +01:00

Merge pull request #965 from owncloud/fix-behavior-if-not-logged-in

Redirect to default page if we are not logged in
This commit is contained in:
Jan-Christoph Borchardt 2015-07-03 16:16:40 +02:00
commit 24a6498ec3

View File

@ -11,8 +11,8 @@
namespace OCA\Contacts;
use OCP\AppFramework\App as MainApp;
use OCP\AppFramework\Http;
use OCP\AppFramework\IAppContainer;
use OCA\Contacts\App;
use OCA\Contacts\Middleware\Http as HttpMiddleware;
use OCA\Contacts\Controller\PageController;
use OCA\Contacts\Controller\AddressBookController;
@ -27,9 +27,8 @@ use OCA\Contacts\Controller\ExportController;
/**
* This class manages our app actions
*
* TODO: Merge with App
* TODO: Build app properly on basis of AppFramework
*/
class Dispatcher extends MainApp {
/**
@ -57,7 +56,11 @@ class Dispatcher extends MainApp {
parent::__construct($this->appName, $params);
$this->container = $this->getContainer();
$this->server = $this->container->getServer();
$userId = \OC::$server->getUserSession()->getUser()->getUID();
$user = \OC::$server->getUserSession()->getUser();
if (is_null($user)) {
\OC_Util::redirectToDefaultPage();
}
$userId = $user->getUID();
$this->app = new App($userId);
$this->registerServices();
$this->container->registerMiddleware('HttpMiddleware');